ActionService { public void markAlertAsClosed(String caseId, String anmIdentifier, String visitCode, String completionDate) { allActions.add(new Action(caseId, anmIdentifier, ActionData.markAlertAsClosed(visitCode, completionDate))); } @Autowired  ActionService(AllActions allActions, AllMothers allMothers, AllChildren allChildren, AllEligibleCouples allEligibleCouples); List<Action> getNewAlertsForANM(String anmIdentifier, long timeStamp); void alertForBeneficiary(BeneficiaryType beneficiaryType, String caseID, String scheduleName, String visitCode, AlertStatus alertStatus, DateTime startDate, DateTime expiryDate); void markAllAlertsAsInactive(String entityId); void markAlertAsInactive(String anmId, String entityId, String scheduleName); void markAlertAsClosed(String caseId, String anmIdentifier, String visitCode, String completionDate); void closeMother(String caseId, String anmIdentifier, String reasonForClose); void reportForIndicator(String anmIdentifier, ActionData actionData); void deleteReportActions();  }
@Test public void shouldCreateACloseActionForAVisitOfAChild() throws Exception { service.markAlertAsClosed("Case X", "ANM 1", "OPV 1", "2012-01-01"); verify(allActions).add(new Action("Case X", "ANM 1", ActionData.markAlertAsClosed("OPV 1", "2012-01-01"))); }
@Test public void shouldCreateACloseActionForAVisitOfAMother() throws Exception { when(allMothers.findByCaseId("Case X")).thenReturn(new Mother("Case X", "EC-CASE-1", "Thayi 1").withAnm("ANM ID 1").withLocation("bherya", "Sub Center", "PHC X")); service.markAlertAsClosed("Case X", "ANM ID 1", "ANC 1", "2012-12-12"); verify(allActions).add(new Action("Case X", "ANM ID 1", ActionData.markAlertAsClosed("ANC 1", "2012-12-12"))); }