@Test public void testFailState() { TestingComponent component = new TestingComponent(); final MonitorRegistry registry = mock(MonitorRegistry.class); SimpleHealthMonitor monitor = new SimpleHealthMonitor("blah", component, registry, Status.WARN); ArgumentCaptor<Monitor> captor = ArgumentCaptor.forClass(Monitor.class); verify(registry, times(1)).addMonitor(captor.capture()); assertSame(monitor, captor.getValue()); assertEquals("blah",monitor.getName()); component.healthy = false; assertEquals(Status.WARN, monitor.getStatus()); component.healthy = true; assertEquals(Status.OK, monitor.getStatus()); component.healthy = false; assertEquals(Status.WARN, monitor.getStatus()); }
@Override public String getName() { return monitorName; }
SimpleHealthMonitor extends OnDemandMonitor { @Override public String getName() { return monitorName; } }
SimpleHealthMonitor extends OnDemandMonitor { @Override public String getName() { return monitorName; } SimpleHealthMonitor(String monitorName, HealthAware component, MonitorRegistry registry, Status failState); }
SimpleHealthMonitor extends OnDemandMonitor { @Override public String getName() { return monitorName; } SimpleHealthMonitor(String monitorName, HealthAware component, MonitorRegistry registry, Status failState); @Override String getName(); @Override Status checkStatus(); }
SimpleHealthMonitor extends OnDemandMonitor { @Override public String getName() { return monitorName; } SimpleHealthMonitor(String monitorName, HealthAware component, MonitorRegistry registry, Status failState); @Override String getName(); @Override Status checkStatus();  }