Skip to content

Commit

Permalink
Additional test for String multiple serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
Clément Denis authored and alarribeau committed Sep 26, 2019
1 parent 4534ab1 commit 16f4684
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.google.api.server.spi.config.Transformer;
import com.google.api.server.spi.config.model.ApiConfig;
import com.google.api.server.spi.config.model.SchemaRepository;
import com.google.api.server.spi.config.model.Serializers;
import com.google.api.server.spi.testing.DefaultValueSerializer;
import com.google.api.server.spi.testing.DuplicateMethodEndpoint;
import com.google.api.server.spi.testing.PassAuthenticator;
Expand Down Expand Up @@ -238,12 +239,15 @@ final class TestSerializer extends DefaultValueSerializer<String, Boolean> {}
public void testMultipleSerializersInstalled() throws Exception {
// TODO: The generic component of Comparable causes validation to miss certain error
// cases like this.
@SuppressWarnings("rawtypes")
final class ComparableSerializer extends DefaultValueSerializer<Comparable<String>, Integer> {}
final class CharSequenceSerializer extends DefaultValueSerializer<CharSequence, Long> {}
config.getSerializationConfig().addSerializationConfig(ComparableSerializer.class);
config.getSerializationConfig().addSerializationConfig(CharSequenceSerializer.class);

List<Class<? extends Transformer<?, ?>>> serializerClasses = Serializers
.getSerializerClasses(TypeToken.of(String.class), config.getSerializationConfig());
assertThat(serializerClasses.size()).isEqualTo(2);

try {
validator.validate(config);
fail("Expected MultipleTransformersException.");
Expand Down

0 comments on commit 16f4684

Please sign in to comment.