SlaCheckerEmailService { public boolean shouldResendEmail(DateTime previousEmailDateTime) { DateTime now = dateTimeUtils.now(); return previousEmailDateTime.isBefore(now.minus(slaCheckerEmailConfig.getPeriodBetweenEmail())); }  void sendCloseIncidentEmail(long incidentId); void sendOpenIncidentEmail(long incidentId, List<Repository> ooslaRepositories); boolean shouldResendEmail(DateTime previousEmailDateTime);  }
@Test public void testShouldResendEmailYes() { DateTime now = new DateTime("2018-06-08T14:00:00.000-07:00"); doReturn(now).when(dateTimeUtils).now(); DateTime previousEmailDateTime = new DateTime("2018-06-08T12:00:00.000-07:00"); boolean shouldResendEmail = slaCheckerEmailService.shouldResendEmail(previousEmailDateTime); assertTrue(shouldResendEmail); }
@Test public void testShouldResendEmailNo() { DateTime now = new DateTime("2018-06-08T14:00:00.000-07:00"); doReturn(now).when(dateTimeUtils).now(); DateTime previousEmailDateTime = new DateTime("2018-06-08T13:30:00.000-07:00"); boolean shouldResendEmail = slaCheckerEmailService.shouldResendEmail(previousEmailDateTime); assertFalse(shouldResendEmail); }