Types { public static Type generic(Class<?> rawType, Type... arguments) { return new ParameterizedTypeImpl(rawType, arguments); }  static Type generic(Class<?> rawType, Type... arguments); static Type optional(Type valueType); static Type list(Type valueType); static Type map(Type keyType, Type valueType); static Type supplier(Type valueType);  }
@Test void equalsToBuiltInType() throws NoSuchFieldException { Type builtInType = TypesTest.class.getDeclaredField("list").getGenericType(); Type constructedType = Types.generic(List.class, String.class); assertThat(constructedType).isEqualTo(builtInType) .hasSameHashCodeAs(builtInType); assertThat(builtInType).isEqualTo(constructedType) .hasSameHashCodeAs(constructedType); }