Example #1
0
 @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());
 }
Example #2
0
 @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));
 }