### Question:
HealthMonitor { public void addCallback(Callback cb) { this.callbacks.add(cb); } HealthMonitor(Configuration conf, HAServiceTarget target); void addCallback(Callback cb); void removeCallback(Callback cb); void shutdown(); synchronized HAServiceProtocol getProxy();  }### Answer:
@Test(timeout=15000) public void testCallbackThrowsRTE() throws Exception { hm.addCallback(new Callback() { @Override public void enteredState(State newState) { throw new RuntimeException("Injected RTE"); } }); LOG.info("Mocking bad health check, waiting for UNHEALTHY"); svc.isHealthy = false; waitForState(hm, HealthMonitor.State.HEALTH_MONITOR_FAILED); }