@Test public void healthcheck_binds_work() { final HealthCheck healthCheck = mock(HealthCheck.class); final Class<TestHealthCheck> healthCheckClass = TestHealthCheck.class; Injector injector = Guice.createInjector(new AbstractPlugin() { @Override protected void configure() { bindHealthCheck(healthCheck); bindHealthCheck(healthCheckClass); } }); Set<HealthCheck> healthCheckSet = injector.getInstance(Keys.HealthChecks); Set<Class<? extends HealthCheck>> healthCheckClassSet = injector.getInstance(Keys.HealthCheckClasses); assertThat(healthCheckSet, hasSize(1)); assertThat(healthCheckSet, hasItem(healthCheck)); assertThat(healthCheckClassSet, hasSize(1)); assertThat(healthCheckClassSet, hasItem(TestHealthCheck.class)); }
protected void bindHealthCheck(HealthCheck healthCheck) { Preconditions.checkNotNull(healthCheck, "Health Check cannot be null."); buildBinders(); healthCheckBinder.addBinding().toInstance(healthCheck); }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindHealthCheck(HealthCheck healthCheck) { Preconditions.checkNotNull(healthCheck, "Health Check cannot be null."); buildBinders(); healthCheckBinder.addBinding().toInstance(healthCheck); } }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindHealthCheck(HealthCheck healthCheck) { Preconditions.checkNotNull(healthCheck, "Health Check cannot be null."); buildBinders(); healthCheckBinder.addBinding().toInstance(healthCheck); }  }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindHealthCheck(HealthCheck healthCheck) { Preconditions.checkNotNull(healthCheck, "Health Check cannot be null."); buildBinders(); healthCheckBinder.addBinding().toInstance(healthCheck); }   }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindHealthCheck(HealthCheck healthCheck) { Preconditions.checkNotNull(healthCheck, "Health Check cannot be null."); buildBinders(); healthCheckBinder.addBinding().toInstance(healthCheck); }    }