HealthCheckService { public boolean isDatabaseUp(ExperimentDao experimentDao) { try { return experimentDao.countExperiments() > 0; } catch (Exception e) { LOGGER.error(e.getMessage()); return false; } } HealthCheckService(SolrCloudAdminProxy solrCloudAdminProxy); boolean isSolrUp(List<String> solrCollections, String... solrCollectionsWithAliases); boolean isDatabaseUp(ExperimentDao experimentDao);  }
@Test void experimentsDatabaseIsUp() { when(experimentDaoMock.countExperiments()).thenReturn(9); assertThat(subject.isDatabaseUp(experimentDaoMock)).isTrue(); }
@Test void noExperimentsInDatabase() { when(experimentDaoMock.countExperiments()).thenReturn(0); assertThat(subject.isDatabaseUp(experimentDaoMock)).isFalse(); }
@Test void experimentDaoThrowsException() { when(experimentDaoMock.countExperiments()).thenThrow(RuntimeException.class); assertThat(subject.isDatabaseUp(experimentDaoMock)).isFalse(); }