@Test public void whenNotConnectingToDatabaseHealthCheckReturnsUnhealthly() { RuntimeException exception = new RuntimeException("test-exception"); when(healthCheckService.checkDatabaseConnection()).thenThrow(exception); HealthCheck.Result result = check.check(); assertEquals(false, result.isHealthy()); assertEquals(exception, result.getError()); }
@Override protected Result check() { try { healthCheckService.checkDatabaseConnection(); return HealthCheck.Result.healthy("Connection to nFlow database is OK."); } catch(Exception e) { return HealthCheck.Result.unhealthy(e); } }
DatabaseConnectionHealthCheck extends HealthCheck { @Override protected Result check() { try { healthCheckService.checkDatabaseConnection(); return HealthCheck.Result.healthy("Connection to nFlow database is OK."); } catch(Exception e) { return HealthCheck.Result.unhealthy(e); } } }
DatabaseConnectionHealthCheck extends HealthCheck { @Override protected Result check() { try { healthCheckService.checkDatabaseConnection(); return HealthCheck.Result.healthy("Connection to nFlow database is OK."); } catch(Exception e) { return HealthCheck.Result.unhealthy(e); } } DatabaseConnectionHealthCheck(HealthCheckService healthCheckService); }
DatabaseConnectionHealthCheck extends HealthCheck { @Override protected Result check() { try { healthCheckService.checkDatabaseConnection(); return HealthCheck.Result.healthy("Connection to nFlow database is OK."); } catch(Exception e) { return HealthCheck.Result.unhealthy(e); } } DatabaseConnectionHealthCheck(HealthCheckService healthCheckService);  }
DatabaseConnectionHealthCheck extends HealthCheck { @Override protected Result check() { try { healthCheckService.checkDatabaseConnection(); return HealthCheck.Result.healthy("Connection to nFlow database is OK."); } catch(Exception e) { return HealthCheck.Result.unhealthy(e); } } DatabaseConnectionHealthCheck(HealthCheckService healthCheckService);   }