@Test public void provides_dropwizard_components() { ObjectMapper objectMapper = mock(ObjectMapper.class); MetricRegistry metricRegistry = mock(MetricRegistry.class); when(environment.getObjectMapper()).thenReturn(objectMapper); when(environment.metrics()).thenReturn(metricRegistry); dropwizardModule.setup(configuration, environment); Injector injector = Guice.createInjector(dropwizardModule); PlatformConfiguration actualConfiguration = injector.getInstance(Key.get(PlatformConfiguration.class, Graceland.class)); ObjectMapper actualObjectMapper = injector.getInstance(Key.get(ObjectMapper.class, Graceland.class)); MetricRegistry actualMetricRegistry = injector.getInstance(Key.get(MetricRegistry.class, Graceland.class)); Environment actualEnvironment = injector.getInstance(Key.get(Environment.class, Graceland.class)); assertThat(actualConfiguration, is(configuration)); assertThat(actualObjectMapper, is(objectMapper)); assertThat(actualMetricRegistry, is(metricRegistry)); assertThat(actualEnvironment, is(environment)); }
public void setup(PlatformConfiguration config, Environment env) { this.configuration = Preconditions.checkNotNull(config, "Configuration cannot be null."); this.environment = Preconditions.checkNotNull(env, "Environment cannot be null."); }
DropwizardModule extends AbstractModule { public void setup(PlatformConfiguration config, Environment env) { this.configuration = Preconditions.checkNotNull(config, "Configuration cannot be null."); this.environment = Preconditions.checkNotNull(env, "Environment cannot be null."); } }
DropwizardModule extends AbstractModule { public void setup(PlatformConfiguration config, Environment env) { this.configuration = Preconditions.checkNotNull(config, "Configuration cannot be null."); this.environment = Preconditions.checkNotNull(env, "Environment cannot be null."); }  }
DropwizardModule extends AbstractModule { public void setup(PlatformConfiguration config, Environment env) { this.configuration = Preconditions.checkNotNull(config, "Configuration cannot be null."); this.environment = Preconditions.checkNotNull(env, "Environment cannot be null."); }  void setup(PlatformConfiguration config, Environment env); }
DropwizardModule extends AbstractModule { public void setup(PlatformConfiguration config, Environment env) { this.configuration = Preconditions.checkNotNull(config, "Configuration cannot be null."); this.environment = Preconditions.checkNotNull(env, "Environment cannot be null."); }  void setup(PlatformConfiguration config, Environment env);  }