DefaultMessageMapperFactory implements MessageMapperFactory { Optional<MessageMapper> createMessageMapperInstance(final String mappingEngine) { if (registeredMappers.containsKey(mappingEngine)) { final Class<?> messageMapperClass = registeredMappers.get(mappingEngine); MessageMapper result = createAnyMessageMapper(messageMapperClass, actorSystem.dynamicAccess()); for (final MessageMapperExtension extension : messageMapperExtensions) { if (null == result) { return Optional.empty(); } result = extension.apply(connectionId, result, actorSystem); } return Optional.ofNullable(result); } else { log.info("Mapper {} not found.", mappingEngine); return Optional.empty(); } } private  DefaultMessageMapperFactory(final ConnectionId connectionId,
            final MappingConfig mappingConfig,
            final ExtendedActorSystem actorSystem,
            final List<MessageMapperExtension> messageMapperExtensions,
            final LoggingAdapter log); static DefaultMessageMapperFactory of(final ConnectionId connectionId,
            final ActorSystem actorSystem,
            final MappingConfig mappingConfig,
            final LoggingAdapter log); @Override Optional<MessageMapper> mapperOf(final String mapperId, final MappingContext mappingContext); @Override MessageMapperRegistry registryOf(final MappingContext defaultContext,
            final PayloadMappingDefinition payloadMappingDefinition); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test public void createWithFactoryMethod() { assertThat(underTest.createMessageMapperInstance("test")).isPresent(); }
@Test public void createWithClassName() { assertThat(underTest.createMessageMapperInstance("test")).isPresent(); }
@Test public void createWithClassNameFindsNoClass() { assertThat(underTest.createMessageMapperInstance("strong-smell-wasabi")).isEmpty(); }
@Test public void createWithClassNameFailsForNonMapperClass() { assertThat(underTest.createMessageMapperInstance(String.class.getCanonicalName())).isEmpty(); }