This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 690b55db3 Unit test modernization.
690b55db3 is described below

commit 690b55db31c874ea65523192aba11a5c7273b5d1
Author: James Bognar <[email protected]>
AuthorDate: Thu Aug 7 10:56:29 2025 -0400

    Unit test modernization.
---
 .../java/org/apache/juneau/AssertionHelpers.java   | 12 ++++
 .../test/java/org/apache/juneau/ClassMetaTest.java | 47 ++++++----------
 .../collections/ControlledArrayList_Test.java      | 26 ++++-----
 .../juneau/objecttools/ObjectPaginator_Test.java   | 65 ++++++++++------------
 .../apache/juneau/reflect/AnnotationInfoTest.java  | 14 ++---
 5 files changed, 76 insertions(+), 88 deletions(-)

diff --git a/juneau-utest/src/test/java/org/apache/juneau/AssertionHelpers.java 
b/juneau-utest/src/test/java/org/apache/juneau/AssertionHelpers.java
index 9941fecd7..e7558522e 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/AssertionHelpers.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/AssertionHelpers.java
@@ -1,3 +1,15 @@
+// 
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file *
+// * distributed with this work for additional information regarding copyright 
ownership.  The ASF licenses this file        *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance            *
+// * with the License.  You may obtain a copy of the License at                
                                              *
+// *                                                                           
                                              *
+// *  http://www.apache.org/licenses/LICENSE-2.0                               
                                              *
+// *                                                                           
                                              *
+// * Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an  *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
express or implied.  See the License for the        *
+// * specific language governing permissions and limitations under the 
License.                                              *
+// 
***************************************************************************************************************************
 package org.apache.juneau;
 
 import static org.apache.juneau.common.internal.StringUtils.*;
diff --git a/juneau-utest/src/test/java/org/apache/juneau/ClassMetaTest.java 
b/juneau-utest/src/test/java/org/apache/juneau/ClassMetaTest.java
index 179396474..57d327f34 100755
--- a/juneau-utest/src/test/java/org/apache/juneau/ClassMetaTest.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/ClassMetaTest.java
@@ -12,20 +12,16 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau;
 
-import static org.apache.juneau.assertions.Assertions.*;
 import static org.apache.juneau.internal.CollectionUtils.*;
 import static org.junit.Assert.*;
-import static org.junit.runners.MethodSorters.*;
-
 import java.util.*;
 
 import org.apache.juneau.reflect.ClassInfoTest.*;
 import org.apache.juneau.swap.*;
-import org.junit.*;
+import org.junit.jupiter.api.*;
 
 @SuppressWarnings({"rawtypes","serial"})
-@FixMethodOrder(NAME_ASCENDING)
-public class ClassMetaTest {
+class ClassMetaTest extends SimpleTestBase {
 
        BeanContext bc = BeanContext.DEFAULT;
 
@@ -35,8 +31,7 @@ public class ClassMetaTest {
 
        public Map<String,String> fa;
 
-       @Test
-       public void a01_map() throws Exception {
+       @Test void a01_map() throws Exception {
                ClassMeta t = 
bc.getClassMeta(this.getClass().getField("fa").getGenericType());
                
assertEquals("java.util.Map<java.lang.String,java.lang.String>", t.toString());
                assertTrue(t.isMap());
@@ -49,8 +44,7 @@ public class ClassMetaTest {
 
        public String fb;
 
-       @Test
-       public void a02_string() throws Exception {
+       @Test void a02_string() throws Exception {
                ClassMeta t = 
bc.getClassMeta(this.getClass().getField("fb").getGenericType());
                assertEquals(String.class, t.getInnerClass());
                t = bc.getClassMeta(this.getClass().getField("fb").getType());
@@ -59,8 +53,7 @@ public class ClassMetaTest {
 
        public Map<String,Map<String,Integer>> fc;
 
-       @Test
-       public void a03_mapWithMapValues() throws Exception {
+       @Test void a03_mapWithMapValues() throws Exception {
                ClassMeta t = 
bc.getClassMeta(this.getClass().getField("fc").getGenericType());
                
assertEquals("java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>>",
 t.toString());
                t = bc.getClassMeta(this.getClass().getField("fc").getType());
@@ -69,8 +62,7 @@ public class ClassMetaTest {
 
        public List<Map<String,List>> fd;
 
-       @Test
-       public void a04_listWithMapValues() throws Exception {
+       @Test void a04_listWithMapValues() throws Exception {
                ClassMeta t = 
bc.getClassMeta(this.getClass().getField("fd").getGenericType());
                
assertEquals("java.util.List<java.util.Map<java.lang.String,java.util.List>>", 
t.toString());
        }
@@ -78,8 +70,7 @@ public class ClassMetaTest {
        public List<? extends String> fe1;
        public List<? super String> fe2;
 
-       @Test
-       public void a05_listWithUpperBoundGenericEntryTypes() throws Exception {
+       @Test void a05_listWithUpperBoundGenericEntryTypes() throws Exception {
                ClassMeta t = 
bc.getClassMeta(this.getClass().getField("fe1").getGenericType());
                assertEquals("java.util.List", t.toString());
                t = 
bc.getClassMeta(this.getClass().getField("fe2").getGenericType());
@@ -89,8 +80,7 @@ public class ClassMetaTest {
        public class G extends HashMap<String,Object> {}
        public G g;
 
-       @Test
-       public void a06_beanExtendsMap() throws Exception {
+       @Test void a06_beanExtendsMap() throws Exception {
                ClassMeta t = 
bc.getClassMeta(this.getClass().getField("g").getGenericType());
                
assertEquals("org.apache.juneau.ClassMetaTest$G<java.lang.String,java.lang.Object>",
 t.toString());
                assertTrue(t.isMap());
@@ -111,8 +101,7 @@ public class ClassMetaTest {
        public static class BC2Swap extends ObjectSwap<BC2,Map> {}
        public static class BI2Swap extends ObjectSwap<BI2,Map> {}
 
-       @Test
-       public void b01_swaps() {
+       @Test void b01_swaps() {
                BeanContext bc2;
                ClassMeta<?> ooo, hi1, hc1, hi2, hc2;
                BeanSession bs;
@@ -293,31 +282,29 @@ public class ClassMetaTest {
        static class C4 extends C3 {}
        static class C5 implements CI3 {}
 
-       @Test
-       public void forEachAnnotation() {
+       @Test void forEachAnnotation() {
                ClassMeta<?> c3 = bc.getClassMeta(C3.class);
                ClassMeta<?> c4 = bc.getClassMeta(C4.class);
                ClassMeta<?> c5 = bc.getClassMeta(C5.class);
 
                List<Integer> l1 = list();
                c3.forEachAnnotation(A.class, null, x -> l1.add(x.value()));
-               assertList(l1).asCdl().isString("2,1,3,5,6,7");
+               assertList(l1, "2,1,3,5,6,7");
 
                List<Integer> l2 = list();
                c4.forEachAnnotation(A.class, null, x -> l2.add(x.value()));
-               assertList(l2).asCdl().isString("2,1,3,5,6,7");
+               assertList(l2, "2,1,3,5,6,7");
 
                List<Integer> l3 = list();
                c5.forEachAnnotation(A.class, null, x -> l3.add(x.value()));
-               assertList(l3).asCdl().isString("3");
+               assertList(l3, "3");
 
                List<Integer> l4 = list();
                c3.forEachAnnotation(A.class, x -> x.value() == 5, x -> 
l4.add(x.value()));
-               assertList(l4).asCdl().isString("5");
+               assertList(l4, "5");
        }
 
-       @Test
-       public void firstAnnotation() {
+       @Test void firstAnnotation() {
                ClassMeta<?> c3 = bc.getClassMeta(C3.class);
                ClassMeta<?> c4 = bc.getClassMeta(C4.class);
                ClassMeta<?> c5 = bc.getClassMeta(C5.class);
@@ -326,8 +313,8 @@ public class ClassMetaTest {
                assertEquals(3, c5.firstAnnotation(A.class, 
null).get().value());
                assertEquals(5, c3.firstAnnotation(A.class, x -> x.value() == 
5).get().value());
        }
-       @Test
-       public void lastAnnotation() {
+
+       @Test void lastAnnotation() {
                ClassMeta<?> c3 = bc.getClassMeta(C3.class);
                ClassMeta<?> c4 = bc.getClassMeta(C4.class);
                ClassMeta<?> c5 = bc.getClassMeta(C5.class);
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/collections/ControlledArrayList_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/collections/ControlledArrayList_Test.java
index 83a78fdbb..0c0471598 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/collections/ControlledArrayList_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/collections/ControlledArrayList_Test.java
@@ -52,62 +52,62 @@ public class ControlledArrayList_Test {
                x1.set(0, 2);
                assertThrown(() -> x2.set(0, 
2)).isType(UnsupportedOperationException.class);
                x2.overrideSet(0, 2);
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.add(0, 2);
                assertThrown(() -> x2.add(0, 
2)).isType(UnsupportedOperationException.class);
                x2.overrideAdd(0, 2);
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.remove(0);
                assertThrown(() -> 
x2.remove(0)).isType(UnsupportedOperationException.class);
                x2.overrideRemove(0);
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.addAll(0, Arrays.asList(3));
                assertThrown(() -> x2.addAll(0, 
Arrays.asList(3))).isType(UnsupportedOperationException.class);
                x2.overrideAddAll(0, Arrays.asList(3));
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.replaceAll(x -> x);
                assertThrown(() -> x2.replaceAll(x -> 
x)).isType(UnsupportedOperationException.class);
                x2.overrideReplaceAll(x -> x);
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.sort(null);
                assertThrown(() -> 
x2.sort(null)).isType(UnsupportedOperationException.class);
                x2.overrideSort(null);
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.add(1);
                assertThrown(() -> 
x2.add(1)).isType(UnsupportedOperationException.class);
                x2.overrideAdd(1);
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.remove((Integer)1);
                assertThrown(() -> 
x2.remove((Integer)1)).isType(UnsupportedOperationException.class);
                x2.overrideRemove((Integer)1);
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.addAll(Arrays.asList(3));
                assertThrown(() -> 
x2.addAll(Arrays.asList(3))).isType(UnsupportedOperationException.class);
                x2.overrideAddAll(Arrays.asList(3));
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.removeAll(Arrays.asList(3));
                assertThrown(() -> 
x2.removeAll(Arrays.asList(3))).isType(UnsupportedOperationException.class);
                x2.overrideRemoveAll(Arrays.asList(3));
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.retainAll(Arrays.asList(2));
                assertThrown(() -> 
x2.retainAll(Arrays.asList(2))).isType(UnsupportedOperationException.class);
                x2.overrideRetainAll(Arrays.asList(2));
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.clear();
                
assertThrown(x2::clear).isType(UnsupportedOperationException.class);
                x2.overrideClear();
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.add(1);
                x2.overrideAdd(1);
@@ -115,7 +115,7 @@ public class ControlledArrayList_Test {
                x1.removeIf(x -> x == 1);
                assertThrown(() -> x2.removeIf(x -> x == 
1)).isType(UnsupportedOperationException.class);
                x2.overrideRemoveIf(x -> x == 1);
-               assertList(x1).is(x2);
+               assertEquals(x2, x1);
 
                x1.add(1);
                x2.overrideAdd(1);
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectPaginator_Test.java
 
b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectPaginator_Test.java
index 6ae158b12..79605132d 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectPaginator_Test.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/objecttools/ObjectPaginator_Test.java
@@ -14,18 +14,15 @@ package org.apache.juneau.objecttools;
 
 import static org.apache.juneau.assertions.Assertions.*;
 import static org.junit.Assert.*;
-import static org.junit.runners.MethodSorters.*;
-
 import java.util.*;
 
 import org.apache.juneau.*;
-import org.junit.*;
+import org.junit.jupiter.api.*;
 
 /**
  * Tests the PojoPaginator class.
  */
-@FixMethodOrder(NAME_ASCENDING)
-public class ObjectPaginator_Test {
+class ObjectPaginator_Test extends SimpleTestBase {
 
        ObjectPaginator op = ObjectPaginator.create();
        BeanSession bs = BeanContext.DEFAULT_SESSION;
@@ -34,13 +31,11 @@ public class ObjectPaginator_Test {
        // Null input
        
//-----------------------------------------------------------------------------------------------------------------
 
-       @Test
-       public void a01_nullInput() {
+       @Test void a01_nullInput() {
                assertNull(op.run(bs, null, null));
        }
 
-       @Test
-       public void a02_nonCollectionInput() {
+       @Test void a02_nonCollectionInput() {
                assertObject(op.run(bs, "foo", PageArgs.create(1, 
3))).is("foo");
        }
 
@@ -48,58 +43,56 @@ public class ObjectPaginator_Test {
        // Arrays
        
//-----------------------------------------------------------------------------------------------------------------
 
-       @Test
-       public void b01_arrays_basic() {
+       @Test void b01_arrays_basic() {
                Object in = new int[]{1,2,3};
-               assertList(op.run(in, 0, 3)).isHas(1,2,3);
-               assertList(op.run(in, 1, 3)).isHas(2,3);
-               assertList(op.run(in, 1, 1)).isHas(2);
-               assertList(op.run(in, 4, 1)).isHas();
-               assertList(op.run(in, 0, 0)).isHas();
+               assertList(op.run(in, 0, 3), 1,2,3);
+               assertList(op.run(in, 1, 3), 2,3);
+               assertList(op.run(in, 1, 1), 2);
+               assertList(op.run(in, 4, 1));
+               assertList(op.run(in, 0, 0));
 
                in = new String[]{"1","2","3"};
-               assertList(op.run(in, 1, 1)).isHas("2");
+               assertList(op.run(in, 1, 1), "2");
 
                in = new boolean[]{false,true,false};
-               assertList(op.run(in, 1, 1)).isHas(true);
+               assertList(op.run(in, 1, 1), true);
 
                in = new byte[]{1,2,3};
-               assertList(op.run(in, 1, 1)).isHas((byte)2);
+               assertList(op.run(in, 1, 1), (byte)2);
 
                in = new char[]{'1','2','3'};
-               assertList(op.run(in, 1, 1)).isHas('2');
+               assertList(op.run(in, 1, 1), '2');
 
                in = new double[]{1,2,3};
-               assertList(op.run(in, 1, 1)).isHas((double)2);
+               assertList(op.run(in, 1, 1), (double)2);
 
                in = new float[]{1,2,3};
-               assertList(op.run(in, 1, 1)).isHas((float)2);
+               assertList(op.run(in, 1, 1), (float)2);
 
                in = new long[]{1,2,3};
-               assertList(op.run(in, 1, 1)).isHas((long)2);
+               assertList(op.run(in, 1, 1), (long)2);
 
                in = new short[]{1,2,3};
-               assertList(op.run(in, 1, 1)).isHas((short)2);
+               assertList(op.run(in, 1, 1), (short)2);
        }
 
        
//-----------------------------------------------------------------------------------------------------------------
        // Collections
        
//-----------------------------------------------------------------------------------------------------------------
 
-       @Test
-       public void c01_collections_basic() {
+       @Test void c01_collections_basic() {
                Object in = Arrays.asList(1,2,3);
-               assertList(op.run(in, 0, 3)).isHas(1,2,3);
-               assertList(op.run(in, 1, 3)).isHas(2,3);
-               assertList(op.run(in, 1, 1)).isHas(2);
-               assertList(op.run(in, 4, 1)).isHas();
-               assertList(op.run(in, 0, 0)).isHas();
+               assertList(op.run(in, 0, 3), 1,2,3);
+               assertList(op.run(in, 1, 3), 2,3);
+               assertList(op.run(in, 1, 1), 2);
+               assertList(op.run(in, 4, 1));
+               assertList(op.run(in, 0, 0));
 
                in = new LinkedHashSet<>(Arrays.asList(1,2,3));
-               assertList(op.run(in, 0, 3)).isHas(1,2,3);
-               assertList(op.run(in, 1, 3)).isHas(2,3);
-               assertList(op.run(in, 1, 1)).isHas(2);
-               assertList(op.run(in, 4, 1)).isHas();
-               assertList(op.run(in, 0, 0)).isHas();
+               assertList(op.run(in, 0, 3), 1,2,3);
+               assertList(op.run(in, 1, 3), 2,3);
+               assertList(op.run(in, 1, 1), 2);
+               assertList(op.run(in, 4, 1));
+               assertList(op.run(in, 0, 0));
 }
 }
\ No newline at end of file
diff --git 
a/juneau-utest/src/test/java/org/apache/juneau/reflect/AnnotationInfoTest.java 
b/juneau-utest/src/test/java/org/apache/juneau/reflect/AnnotationInfoTest.java
index 350421cac..e8a4f4ef1 100644
--- 
a/juneau-utest/src/test/java/org/apache/juneau/reflect/AnnotationInfoTest.java
+++ 
b/juneau-utest/src/test/java/org/apache/juneau/reflect/AnnotationInfoTest.java
@@ -14,16 +14,13 @@ package org.apache.juneau.reflect;
 
 import static java.lang.annotation.ElementType.*;
 import static java.lang.annotation.RetentionPolicy.*;
-import static org.apache.juneau.assertions.Assertions.*;
-import static org.junit.runners.MethodSorters.*;
-
 import java.lang.annotation.*;
 
+import org.apache.juneau.*;
 import org.apache.juneau.annotation.*;
-import org.junit.*;
+import org.junit.jupiter.api.*;
 
-@FixMethodOrder(NAME_ASCENDING)
-public class AnnotationInfoTest {
+class AnnotationInfoTest extends SimpleTestBase {
 
        
//-----------------------------------------------------------------------------------------------------------------
        // Is in group.
@@ -46,10 +43,9 @@ public class AnnotationInfoTest {
        @D1 @D2 @D3
        public static class D {}
 
-       @Test
-       public void d01_isInGroup() {
+       @Test void d01_isInGroup() {
                ClassInfo d = ClassInfo.of(D.class);
                AnnotationList l = d.getAnnotationList(x -> 
x.isInGroup(D1.class));
-               assertList(l).isSize(2);
+               assertSize(2, l);
        }
 }
\ No newline at end of file

Reply via email to