MotherService { public void hbTest(FormSubmission submission) { serviceProvidedService.add( forHBTest(submission.entityId(), submission.getFieldValue(HB_LEVEL), submission.getFieldValue(HB_TEST_DATE))); } 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 shouldHandleHBTest() throws Exception { FormSubmission submission = mock(FormSubmission.class); when(submission.entityId()).thenReturn("entity id 1"); when(submission.getFieldValue("hbLevel")).thenReturn("11"); when(submission.getFieldValue("hbTestDate")).thenReturn("2013-01-01"); service.hbTest(submission); verify(serviceProvidedService).add(new ServiceProvided("entity id 1", "Hb Test", "2013-01-01", mapOf("hbLevel", "11"))); }