ANCService { public void deliveryPlanned(FormSubmission submission) { if (!allMothers.exists(submission.entityId())) { logger.warn("Tried to handle delivery plan without registered mother. Submission: " + submission); return; } ancSchedulesService.deliveryHasBeenPlanned(submission.entityId(), submission.anmId(), submission.getField(SUBMISSION_DATE_FIELD_NAME)); } @Autowired  ANCService(AllMothers allMothers,
                      AllEligibleCouples eligibleCouples,
                      ANCSchedulesService ancSchedulesService,
                      ActionService actionService,
                      MotherReportingService reportingService,
                      ReportFieldsDefinition reportFieldsDefinition); void registerANC(FormSubmission submission); void registerOutOfAreaANC(FormSubmission submission); void ancVisit(FormSubmission submission); void ttProvided(FormSubmission submission); void ifaTabletsGiven(FormSubmission submission); void hbTest(FormSubmission submission); void deliveryPlanned(FormSubmission submission); void deliveryOutcome(FormSubmission submission); void close(FormSubmission submission); void ancInvestigations(FormSubmission submission);  }
@Test public void shouldHandleDeliveryPlan() { FormSubmission submission = create() .withFormName("delivery_plan") .withANMId("anm id 1") .withEntityId("entity id 1") .addFormField("someKey", "someValue") .addFormField("submissionDate", "2013-01-01") .build(); when(allMothers.exists("entity id 1")).thenReturn(true); when(reportFieldsDefinition.get("delivery_plan")).thenReturn(asList("someKey")); service.deliveryPlanned(submission); verify(ancSchedulesService).deliveryHasBeenPlanned("entity id 1", "anm id 1", "2013-01-01"); }