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 74e4a6eb23f1ea4ca4dded8d165c2bc7b1c2516e Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sun Jun 15 14:44:54 2025 -0400 Add missing test coverage for org.apache.commons.lang3.reflect.TypeUtils.TypeUtils() --- .../commons/lang3/reflect/TypeUtilsTest.java | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 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 65fc9f744..382056dd8 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java @@ -422,6 +422,11 @@ abstract class Test2<G> { assertTrue(TypeUtils.containsTypeVariables(Test2.class.getMethod("m17").getGenericReturnType())); } + @Test + void testDeprecatedConstructor() { + assertNotNull(new TypeUtils().toString()); + } + @Test void testDetermineTypeVariableAssignments() throws NoSuchFieldException { final ParameterizedType iterableType = (ParameterizedType) getClass().getField("iterable") @@ -984,15 +989,6 @@ void testParameterizeNarrowerTypeArray() { assertEquals(TypeUtils.parameterize(ArrayList.class, String.class), unrolled); } - @Test - void testUnrollVariables() { - final TypeVariable<?>[] variables = ArrayList.class.getTypeParameters(); - final ParameterizedType parameterizedType = TypeUtils.parameterize(ArrayList.class, variables); - assertEquals("java.util.ArrayList<E>", TypeUtils.unrollVariables(null, parameterizedType).getTypeName()); - final Map<TypeVariable<?>, Type> mapping = Collections.<TypeVariable<?>, Type>singletonMap(variables[0], String.class); - assertEquals("java.util.ArrayList<java.lang.String>", TypeUtils.unrollVariables(mapping, parameterizedType).getTypeName()); - } - @Test void testParameterizeNullPointerException() { assertThrows(NullPointerException.class, () -> TypeUtils.parameterize(null, Collections.emptyMap())); @@ -1102,6 +1098,15 @@ void testUnboundedWildcardType() { assertThrows(NullPointerException.class, () -> TypeUtils.getImplicitUpperBounds(null)); } + @Test + void testUnrollVariables() { + final TypeVariable<?>[] variables = ArrayList.class.getTypeParameters(); + final ParameterizedType parameterizedType = TypeUtils.parameterize(ArrayList.class, variables); + assertEquals("java.util.ArrayList<E>", TypeUtils.unrollVariables(null, parameterizedType).getTypeName()); + final Map<TypeVariable<?>, Type> mapping = Collections.<TypeVariable<?>, Type>singletonMap(variables[0], String.class); + assertEquals("java.util.ArrayList<java.lang.String>", TypeUtils.unrollVariables(mapping, parameterizedType).getTypeName()); + } + @Test void testWildcardType() throws NoSuchFieldException { final WildcardType simpleWildcard = TypeUtils.wildcardType().withUpperBounds(String.class).build();