@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, is(equalTo(mapOfStringIntegerType)));
    assertThat(newMapType.hashCode(), is(equalTo(mapOfStringIntegerType.hashCode())));
    assertThat(newMapType.toString(), is(equalTo(mapOfStringIntegerType.toString())));
    Type arrayListOfMapOfStringIntegerType = TypesTest.class.getDeclaredField(
            "arrayListOfMapOfStringInteger").getGenericType();
    ParameterizedType newListType = Types.newParameterizedType(ArrayList.class, newMapType);
    assertThat(newListType, is(equalTo(arrayListOfMapOfStringIntegerType)));
    assertThat(newListType.hashCode(), is(equalTo(arrayListOfMapOfStringIntegerType.hashCode())));
    assertThat(newListType.toString(), is(equalTo(arrayListOfMapOfStringIntegerType.toString())));
}