SlaCheckerEmailService { String getCloseIncidentEmailContent(long incidentId) { CloseIncidentContext slaCloseIncidentContext = new CloseIncidentContext(incidentId); return mustacheTemplateEngine.render(CLOSE_INCIDENT_TEMPLATE, slaCloseIncidentContext); }  void sendCloseIncidentEmail(long incidentId); void sendOpenIncidentEmail(long incidentId, List<Repository> ooslaRepositories); boolean shouldResendEmail(DateTime previousEmailDateTime);  }
@Test public void testGetCloseIncidentEmailContent() { long incidentId = 0L; String renderedContent = "rendered content"; doReturn(renderedContent).when(mustacheTemplateEngine).render(eq(CLOSE_INCIDENT_TEMPLATE), any(CloseIncidentContext.class)); String result = slaCheckerEmailService.getCloseIncidentEmailContent(incidentId); ArgumentCaptor<CloseIncidentContext> acCloseIncidentEmailContext = ArgumentCaptor.forClass(CloseIncidentContext.class); verify(mustacheTemplateEngine).render(eq(CLOSE_INCIDENT_TEMPLATE), acCloseIncidentEmailContext.capture()); assertEquals(renderedContent, result); assertEquals((long) incidentId, (long) acCloseIncidentEmailContext.getValue().incidentId); }