MotherService { public void registerANC(FormSubmission submission) { addTimelineEventsForMotherRegistration(submission); } MotherService(AllBeneficiaries allBeneficiaries, AllEligibleCouples allEligibleCouples,
                         AllTimelineEvents allTimelineEvents, ServiceProvidedService serviceProvidedService); void registerANC(FormSubmission submission); void registerOutOfAreaANC(FormSubmission submission); void ancVisit(FormSubmission submission); void close(FormSubmission submission); void close(String entityId, String reason); void ttProvided(FormSubmission submission); void ifaTabletsGiven(FormSubmission submission); void hbTest(FormSubmission submission); void deliveryOutcome(FormSubmission submission); void pncVisitHappened(FormSubmission submission); void deliveryPlan(FormSubmission submission); static final String MOTHER_ID; static String submissionDate; }
@Test public void shouldRegisterANC() throws Exception { FormSubmission submission = mock(FormSubmission.class); when(submission.entityId()).thenReturn("entity id 1"); when(submission.getFieldValue("motherId")).thenReturn("mother id 1"); when(submission.getFieldValue("thayiCardNumber")).thenReturn("thayi 1"); when(submission.getFieldValue("registrationDate")).thenReturn("2012-01-02"); when(submission.getFieldValue("referenceDate")).thenReturn("2012-01-01"); service.registerANC(submission); allTimelineEvents.add(TimelineEvent.forStartOfPregnancy("mother id 1", "2012-01-02", "2012-01-01")); allTimelineEvents.add(TimelineEvent.forStartOfPregnancyForEC("entity id 1", "thayi 1", "2012-01-02", "2012-01-01")); }