### Question:
HealthService implements IHealthService { @Override public boolean isHealthy() { if (! this.healthDAO.isPortDBConnectionHealthy()) { logger.error("Can't establish connection with Port database schema"); return false; } if (! this.healthDAO.isServDBConnectionHealthy()) { logger.error("Can't establish connection with Serv database schema"); return false; } return true; } @Autowired  HealthService(IHealthDAO healthDAO); HealthService setHealthDAO(IHealthDAO healthDAO); @Override boolean isHealthy();  }### Answer:
@Test public void withPortSchemaNotReachableShouldReturnFalse() { when(healthDAO.isPortDBConnectionHealthy()).thenReturn(false); assertFalse(healthService.isHealthy()); }
@Test public void withServSchemaNotReachableShouldReturnFalse() { when(healthDAO.isPortDBConnectionHealthy()).thenReturn(true); when(healthDAO.isServDBConnectionHealthy()).thenReturn(false); assertFalse(healthService.isHealthy()); }
@Test public void withAllSchemaaReachableShouldReturnTrue() { when(healthDAO.isPortDBConnectionHealthy()).thenReturn(true); when(healthDAO.isServDBConnectionHealthy()).thenReturn(true); assertTrue(healthService.isHealthy()); }