SlaCheckerEmailService { String getOpenIncidentEmailContent(long incidentId, List<Repository> repositories) { OpenIncidentContext slaEmailContext = new OpenIncidentContext(incidentId, repositories, serverConfig.getUrl()); String emailContent = mustacheTemplateEngine.render(OPEN_INCIDENT_TEMPLATE, slaEmailContext); return emailContent; }  void sendCloseIncidentEmail(long incidentId); void sendOpenIncidentEmail(long incidentId, List<Repository> ooslaRepositories); boolean shouldResendEmail(DateTime previousEmailDateTime);  }
@Test public void testGetOpenIncidentEmailContent() { long incidentId = 0L; String renderedContent = "rendered content"; doReturn(renderedContent).when(mustacheTemplateEngine).render(eq(OPEN_INCIDENT_TEMPLATE), any(OpenIncidentContext.class)); List<Repository> repositoriesForTest = new ArrayList<>(); String result = slaCheckerEmailService.getOpenIncidentEmailContent(incidentId, repositoriesForTest); ArgumentCaptor<OpenIncidentContext> acOpenIncidentEmailContext = ArgumentCaptor.forClass(OpenIncidentContext.class); verify(mustacheTemplateEngine).render(eq(OPEN_INCIDENT_TEMPLATE), acOpenIncidentEmailContext.capture()); assertEquals(renderedContent, result); assertEquals((long) incidentId, (long) acOpenIncidentEmailContext.getValue().incidentId); assertEquals(serverConfig.getUrl(), acOpenIncidentEmailContext.getValue().mojitoUrl); assertEquals(repositoriesForTest, acOpenIncidentEmailContext.getValue().repositories); }