use of com.google.auto.value.extension.serializable.serializer.interfaces.Serializer in project auto by google.
the class OptionalSerializerExtensionTest method fromProxy.
@Test
public void fromProxy() {
TypeMirror typeMirror = declaredTypeOf(Optional.class, Integer.class);
Serializer serializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment).get();
CodeBlock actualCodeBlock = serializer.fromProxy(CodeBlock.of("x"));
assertThat(actualCodeBlock.toString()).isEqualTo("java.util.Optional.ofNullable(x == null ? null : x)");
}
use of com.google.auto.value.extension.serializable.serializer.interfaces.Serializer in project auto by google.
the class OptionalSerializerExtensionTest method proxyFieldType.
@Test
public void proxyFieldType() {
TypeMirror typeMirror = declaredTypeOf(Optional.class, Integer.class);
Serializer serializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment).get();
TypeMirror actualTypeMirror = serializer.proxyFieldType();
assertThat(actualTypeMirror).isEqualTo(typeMirrorOf(Integer.class));
}
use of com.google.auto.value.extension.serializable.serializer.interfaces.Serializer in project auto by google.
the class OptionalSerializerExtensionTest method getSerializer_nonOptional_emptyReturned.
@Test
public void getSerializer_nonOptional_emptyReturned() {
TypeMirror typeMirror = typeMirrorOf(String.class);
Optional<Serializer> actualSerializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment);
assertThat(actualSerializer).isEmpty();
}
Aggregations