@Test public void testGenericArrayType() throws Exception { final Type expected = getClass().getField("intWildcardComparable").getGenericType(); final GenericArrayType actual = TypeUtils.genericArrayType( TypeUtils.parameterize( Comparable.class, TypeUtils.wildcardType().withUpperBounds(Integer.class).build())); Assert.assertTrue(TypeUtils.equals(expected, actual)); Assert.assertEquals("java.lang.Comparable<? extends java.lang.Integer>[]", actual.toString()); }
@Test public void testWildcardType() throws Exception { final WildcardType simpleWildcard = TypeUtils.wildcardType().withUpperBounds(String.class).build(); final Field cClass = AClass.class.getField("cClass"); Assert.assertTrue( TypeUtils.equals( ((ParameterizedType) cClass.getGenericType()).getActualTypeArguments()[0], simpleWildcard)); }