### Question:
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);  }### Answer:
@Test(expected = NullPointerException.class) public void setup_cannot_take_null_configuration() { dropwizardModule.setup(null, environment); }
@Test(expected = NullPointerException.class) public void setup_cannot_take_null_environment() { dropwizardModule.setup(configuration, null); }
@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)); }