@Test
public void testInstantiate_classConstructor() {

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