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 b5c38d09e..531722672 100644 --- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java @@ -35,8 +35,10 @@ import java.lang.reflect.TypeVariable; import java.lang.reflect.WildcardType; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -272,6 +274,16 @@ public class TypeUtilsTest extends AbstractLangTest { assertEquals("T extends java.lang.Enum", TypeUtils.toString(method.getGenericReturnType())); } + @Test + public void test_LANG_1698() { + ParameterizedType comparing = (ParameterizedType) Arrays.stream(Comparator.class.getDeclaredMethods()) + .filter(k -> k.getName().equals("comparing")).findFirst() + .orElse(Comparator.class.getDeclaredMethods()[0]).getGenericParameterTypes()[0]; + final String typeName = TypeUtils + .parameterize((Class) comparing.getRawType(), comparing.getActualTypeArguments()).getTypeName(); + assertEquals("java.util.function.Function", typeName); + } + @Test public void test_LANG_820() { final Type[] typeArray = {String.class, String.class}; @@ -1048,7 +1060,7 @@ public class TypeUtilsTest extends AbstractLangTest { assertEquals(String.format("? extends %s", String.class.getName()), TypeUtils.toString(simpleWildcard)); assertEquals(String.format("? extends %s", String.class.getName()), simpleWildcard.toString()); } - + @Test public void testWrap() { final Type t = getClass().getTypeParameters()[0];