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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 502fc65ecad2338aaf2bbb24aaeaee13240a5216
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Jun 15 14:59:43 2025 -0400

    Add missing test coverage for
    org.apache.commons.lang3.reflect.TypeUtils
---
 .../commons/lang3/reflect/TypeUtilsTest.java       | 24 +++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
index 382056dd8..a14a96286 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
@@ -19,6 +19,7 @@
 import static org.junit.jupiter.api.Assertions.assertArrayEquals;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -444,14 +445,18 @@ void testDetermineTypeVariableAssignments() throws 
NoSuchFieldException {
                 () -> TypeUtils.determineTypeArguments(null, iterableType));
     }
 
+    @SuppressWarnings("unlikely-arg-type")
     @Test
     void testGenericArrayType() throws NoSuchFieldException {
         final Type expected = 
getClass().getField("intWildcardComparable").getGenericType();
-        final GenericArrayType actual =
-            
TypeUtils.genericArrayType(TypeUtils.parameterize(Comparable.class, 
TypeUtils.wildcardType()
-                .withUpperBounds(Integer.class).build()));
+        final GenericArrayType actual = TypeUtils
+                .genericArrayType(TypeUtils.parameterize(Comparable.class, 
TypeUtils.wildcardType().withUpperBounds(Integer.class).build()));
         assertTrue(TypeUtils.equals(expected, actual));
         assertEquals("java.lang.Comparable<? extends java.lang.Integer>[]", 
actual.toString());
+        assertNotEquals(0, actual.hashCode());
+        assertEquals(actual, actual);
+        assertFalse(actual.equals(null));
+        assertFalse(actual.equals(TypeUtils.wildcardType().build()));
     }
 
     @Test
@@ -1008,13 +1013,21 @@ void testParameterizeVarArgsNullPointerException() {
         assertThrows(NullPointerException.class, () -> 
TypeUtils.parameterize(null));
     }
 
+    @SuppressWarnings("unlikely-arg-type")
     @Test
     void testParameterizeWithOwner() throws NoSuchFieldException {
         final Type owner = TypeUtils.parameterize(TypeUtilsTest.class, 
String.class);
         final ParameterizedType dat2Type1 = 
TypeUtils.parameterizeWithOwner(owner, That.class, String.class, String.class);
         
assertTrue(TypeUtils.equals(getClass().getField("dat2").getGenericType(), 
dat2Type1));
+        assertNotEquals(0, dat2Type1.hashCode());
+        assertEquals(dat2Type1, dat2Type1);
         final ParameterizedType dat2Type2 = 
TypeUtils.parameterizeWithOwner(null, That.class, String.class, String.class);
         assertEquals(That.class, dat2Type2.getRawType());
+        assertNotEquals(0, dat2Type2.hashCode());
+        assertEquals(dat2Type2, dat2Type2);
+        assertNotEquals(dat2Type2, dat2Type1);
+        assertFalse(dat2Type1.equals(null));
+        
assertFalse(dat2Type1.equals(TypeUtils.genericArrayType(String.class)));
     }
 
     @Test
@@ -1107,6 +1120,7 @@ void testUnrollVariables() {
         assertEquals("java.util.ArrayList<java.lang.String>", 
TypeUtils.unrollVariables(mapping, parameterizedType).getTypeName());
     }
 
+    @SuppressWarnings("unlikely-arg-type")
     @Test
     void testWildcardType() throws NoSuchFieldException {
         final WildcardType simpleWildcard = 
TypeUtils.wildcardType().withUpperBounds(String.class).build();
@@ -1114,6 +1128,10 @@ void testWildcardType() throws NoSuchFieldException {
         assertTrue(TypeUtils.equals(((ParameterizedType) 
cClass.getGenericType()).getActualTypeArguments()[0], simpleWildcard));
         assertEquals(String.format("? extends %s", String.class.getName()), 
TypeUtils.toString(simpleWildcard));
         assertEquals(String.format("? extends %s", String.class.getName()), 
simpleWildcard.toString());
+        assertNotEquals(0, simpleWildcard.hashCode());
+        assertEquals(simpleWildcard, simpleWildcard);
+        assertFalse(simpleWildcard.equals(null));
+        
assertFalse(simpleWildcard.equals(TypeUtils.genericArrayType(String.class)));
     }
 
     @Test

Reply via email to