SlaCheckerService { void checkWithNoOpenIncident() { logger.debug("No incident open, check if new OOSLA repositories appeared"); List<Repository> ooslaRepositories = repositoryRepository.findByDeletedFalseAndCheckSLATrueAndRepositoryStatisticOoslaTextUnitCountGreaterThanOrderByNameAsc(0L); if (ooslaRepositories.isEmpty()) { logger.debug("No repositories are out of SLA"); } else { SlaIncident createIncident = createIncident(ooslaRepositories); slaCheckerEmailService.sendOpenIncidentEmail(createIncident.getId(), ooslaRepositories); } }    }
@Test public void testCheckWithNoOpenIncidentNothing() { doReturn(new ArrayList<>()).when(repositoryRepository).findByDeletedFalseAndCheckSLATrueAndRepositoryStatisticOoslaTextUnitCountGreaterThanOrderByNameAsc(0L); slaCheckerService.checkWithNoOpenIncident(); verify(slaCheckerEmailService, never()).sendOpenIncidentEmail(anyLong(), Matchers.anyList()); }