@Test
public void testInstantiate_typeConstructor() {

  Transformer<List<?>, Type> serializer;
  serializer =
      Serializers.instantiate(ListToTypeSerializer.class, TypeToken.of(ImmutableList.class));
  assertEquals(ImmutableList.class, serializer.transformTo(ImmutableList.of()));
  Type typeWithGeneric = new TypeToken<List<?>>() {}.getType();
  serializer = Serializers.instantiate(ListToTypeSerializer.class, TypeToken.of(typeWithGeneric));
  assertEquals(typeWithGeneric, serializer.transformTo(ImmutableList.of()));
  assertEquals(ImmutableList.of(typeWithGeneric), serializer.transformFrom(List.class));
  try {
    Serializers.instantiate(ListToTypeSerializer.class, TypeToken.of(Collection.class));
    fail("Shouldn't be able to instantiate with Collection");
  } catch (IllegalArgumentException e) {
    // expected
  }
}