Skip to content

Commit 74e4a6e

Browse files
committed
Add missing test coverage for
org.apache.commons.lang3.reflect.TypeUtils.TypeUtils()
1 parent 73d7501 commit 74e4a6e

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,11 @@ abstract class Test2<G> {
422422
assertTrue(TypeUtils.containsTypeVariables(Test2.class.getMethod("m17").getGenericReturnType()));
423423
}
424424

425+
@Test
426+
void testDeprecatedConstructor() {
427+
assertNotNull(new TypeUtils().toString());
428+
}
429+
425430
@Test
426431
void testDetermineTypeVariableAssignments() throws NoSuchFieldException {
427432
final ParameterizedType iterableType = (ParameterizedType) getClass().getField("iterable")
@@ -984,15 +989,6 @@ void testParameterizeNarrowerTypeArray() {
984989
assertEquals(TypeUtils.parameterize(ArrayList.class, String.class), unrolled);
985990
}
986991

987-
@Test
988-
void testUnrollVariables() {
989-
final TypeVariable<?>[] variables = ArrayList.class.getTypeParameters();
990-
final ParameterizedType parameterizedType = TypeUtils.parameterize(ArrayList.class, variables);
991-
assertEquals("java.util.ArrayList<E>", TypeUtils.unrollVariables(null, parameterizedType).getTypeName());
992-
final Map<TypeVariable<?>, Type> mapping = Collections.<TypeVariable<?>, Type>singletonMap(variables[0], String.class);
993-
assertEquals("java.util.ArrayList<java.lang.String>", TypeUtils.unrollVariables(mapping, parameterizedType).getTypeName());
994-
}
995-
996992
@Test
997993
void testParameterizeNullPointerException() {
998994
assertThrows(NullPointerException.class, () -> TypeUtils.parameterize(null, Collections.emptyMap()));
@@ -1102,6 +1098,15 @@ void testUnboundedWildcardType() {
11021098
assertThrows(NullPointerException.class, () -> TypeUtils.getImplicitUpperBounds(null));
11031099
}
11041100

1101+
@Test
1102+
void testUnrollVariables() {
1103+
final TypeVariable<?>[] variables = ArrayList.class.getTypeParameters();
1104+
final ParameterizedType parameterizedType = TypeUtils.parameterize(ArrayList.class, variables);
1105+
assertEquals("java.util.ArrayList<E>", TypeUtils.unrollVariables(null, parameterizedType).getTypeName());
1106+
final Map<TypeVariable<?>, Type> mapping = Collections.<TypeVariable<?>, Type>singletonMap(variables[0], String.class);
1107+
assertEquals("java.util.ArrayList<java.lang.String>", TypeUtils.unrollVariables(mapping, parameterizedType).getTypeName());
1108+
}
1109+
11051110
@Test
11061111
void testWildcardType() throws NoSuchFieldException {
11071112
final WildcardType simpleWildcard = TypeUtils.wildcardType().withUpperBounds(String.class).build();

0 commit comments

Comments
 (0)