MotherReporter implements IReporter { @Override public void report(String entityId, String reportIndicator, Location location, String serviceProvidedDate, SafeMap reportData) { Mother mother = allMothers.findByCaseId(entityId); motherReportingService.reportToBoth(mother, Indicator.from(reportIndicator), serviceProvidedDate, reportData.get(SUBMISSION_DATE_FIELD_NAME), location); } @Autowired  MotherReporter(MotherReportingService motherReportingService, AllMothers allMothers); @Override void report(String entityId, String reportIndicator, Location location, String serviceProvidedDate, SafeMap reportData);  }
@Test public void shouldCallMotherReporting() { FormSubmission submission = create() .withEntityId("mother id 1") .build(); Location location = new Location("village", "sc", "phc"); SafeMap safeMap = new SafeMap().put("submissionDate", "2012-03-01"); when(allMothers.findByCaseId("mother id 1")).thenReturn(mother); motherReporter.report(submission.entityId(), "MMA", location, "2012-03-01", safeMap); verify(motherReportingService).reportToBoth(mother, Indicator.from("MMA"), safeMap.get("submissionDate"), safeMap.get("submissionDate"), location); }