### Question:
Types { public static ParameterizedType newParameterizedType(Type rawType, Type... typeArguments) { if (typeArguments.length == 0) { throw new IllegalArgumentException("Missing type arguments for " + rawType); } return new ParameterizedTypeImpl(null, rawType, typeArguments); } private  Types(); static String generatedJsonAdapterName(Class<?> clazz); static String generatedJsonAdapterName(String className); static @Nullable Set<? extends Annotation> nextAnnotations(
      Set<? extends Annotation> annotations, Class<? extends Annotation> jsonQualifier); static ParameterizedType newParameterizedType(Type rawType, Type... typeArguments); static ParameterizedType newParameterizedTypeWithOwner(
      Type ownerType, Type rawType, Type... typeArguments); static GenericArrayType arrayOf(Type componentType); static WildcardType subtypeOf(Type bound); static WildcardType supertypeOf(Type bound); static Class<?> getRawType(Type type); static Type collectionElementType(Type context, Class<?> contextRawType); static boolean equals(@Nullable Type a, @Nullable Type b); static Set<? extends Annotation> getFieldJsonQualifierAnnotations(
      Class<?> clazz, String fieldName);  }### Answer:
@Test public void newParameterizedTypeObjectMethods() throws Exception { Type mapOfStringIntegerType = TypesTest.class.getDeclaredField("mapOfStringInteger").getGenericType(); ParameterizedType newMapType = Types.newParameterizedType(Map.class, String.class, Integer.class); assertThat(newMapType).isEqualTo(mapOfStringIntegerType); assertThat(newMapType.hashCode()).isEqualTo(mapOfStringIntegerType.hashCode()); assertThat(newMapType.toString()).isEqualTo(mapOfStringIntegerType.toString()); Type arrayListOfMapOfStringIntegerType = TypesTest.class.getDeclaredField("arrayListOfMapOfStringInteger").getGenericType(); ParameterizedType newListType = Types.newParameterizedType(ArrayList.class, newMapType); assertThat(newListType).isEqualTo(arrayListOfMapOfStringIntegerType); assertThat(newListType.hashCode()).isEqualTo(arrayListOfMapOfStringIntegerType.hashCode()); assertThat(newListType.toString()).isEqualTo(arrayListOfMapOfStringIntegerType.toString()); }
@Test public void newParameterizedType() throws Exception { Type type = Types.newParameterizedType(List.class, A.class); assertThat(getFirstTypeArgument(type)).isEqualTo(A.class); type = Types.newParameterizedTypeWithOwner(TypesTest.class, A.class, B.class); assertThat(getFirstTypeArgument(type)).isEqualTo(B.class); }
@Test public void parameterizedTypeWithRequiredOwnerMissing() throws Exception { try { Types.newParameterizedType(A.class, B.class); fail(); } catch (IllegalArgumentException expected) { assertThat(expected) .hasMessageThat() .isEqualTo("unexpected owner type for " + A.class + ": null"); } }