### Question:
SerializerFactoryImpl implements SerializerFactory { @Override public Serializer getSerializer(TypeMirror typeMirror) { for (SerializerExtension extension : extensions) { Optional<Serializer> serializer = extension.getSerializer(typeMirror, this, env); if (serializer.isPresent()) { return serializer.get(); } } return IdentitySerializerFactory.getSerializer(typeMirror); } SerializerFactoryImpl(
      ImmutableList<SerializerExtension> extensions, ProcessingEnvironment env); @Override Serializer getSerializer(TypeMirror typeMirror);  }### Answer:
@Test public void getSerializer_emptyFactories_identitySerializerReturned() throws Exception { SerializerFactoryImpl factory = new SerializerFactoryImpl(ImmutableList.of(), mockProcessingEnvironment); Serializer actualSerializer = factory.getSerializer(typeMirrorOf(String.class)); assertThat(actualSerializer.getClass().getName()) .contains("IdentitySerializerFactory$IdentitySerializer"); }
@Test public void getSerializer_factoriesProvided_factoryReturned() throws Exception { SerializerFactoryImpl factory = new SerializerFactoryImpl( ImmutableList.of(new TestStringSerializerFactory()), mockProcessingEnvironment); Serializer actualSerializer = factory.getSerializer(typeMirrorOf(String.class)); assertThat(actualSerializer.getClass().getName()) .contains("TestStringSerializerFactory$TestStringSerializer"); }