Skip to content

Commit 456be09

Browse files
committed
Add missing test coverage for
org.apache.commons.lang3.reflect.TypeUtils.equals(Type, Type)
1 parent 51e7eb3 commit 456be09

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,19 @@ void testDetermineTypeArguments() throws NoSuchFieldException {
440440
assertThrows(NullPointerException.class, () -> TypeUtils.determineTypeArguments(null, iterableType));
441441
}
442442

443+
@Test
444+
void testEquals() throws NoSuchFieldException {
445+
final Type expected = getClass().getField("intWildcardComparable").getGenericType();
446+
final GenericArrayType gat1 = TypeUtils
447+
.genericArrayType(TypeUtils.parameterize(Comparable.class, TypeUtils.wildcardType().withUpperBounds(Integer.class).build()));
448+
final GenericArrayType gat2 = TypeUtils
449+
.genericArrayType(TypeUtils.parameterize(Comparable.class, TypeUtils.wildcardType().withUpperBounds(Integer.class).build()));
450+
assertTrue(TypeUtils.equals(gat1, gat1));
451+
assertTrue(TypeUtils.equals(gat1, gat2));
452+
assertFalse(TypeUtils.equals(gat1, null));
453+
assertFalse(TypeUtils.equals(null, gat1));
454+
}
455+
443456
@SuppressWarnings("unlikely-arg-type")
444457
@Test
445458
void testGenericArrayType() throws NoSuchFieldException {

0 commit comments

Comments
 (0)