use of io.dropwizard.logging.LoggingFactory in project dropwizard by dropwizard.
the class ConfiguredCommandTest method canUseCustomConfigurationFactory.
@SuppressWarnings("unchecked")
@Test
void canUseCustomConfigurationFactory() throws Exception {
Configuration configuration = mock(Configuration.class);
LoggingFactory loggingFactory = mock(LoggingFactory.class);
ConfigurationFactory<Configuration> factory = Mockito.mock(ConfigurationFactory.class);
when(factory.build()).thenReturn(configuration);
when(configuration.getLoggingFactory()).thenReturn(loggingFactory);
bootstrap.setConfigurationFactoryFactory((klass, validator, objectMapper, propertyPrefix) -> factory);
assertThat(command.getConfiguration()).isNull();
command.run(bootstrap, namespace);
assertThat(command.getConfiguration()).isEqualTo(configuration);
Mockito.verify(factory).build();
}
Aggregations