@Test
  public void shouldAddNewPNCVisitDateToPNCVisitsDatesThatHappened() throws Exception {
    when(reportFieldsDefinition.get("pnc_visit")).thenReturn(asList("pncVisitDate"));
    Mother mother =
        new Mother("mother id 1", "ec id 1", "TC1")
            .withDetails(
                EasyMap.create("some-key", "some-value").put("pncVisitDates", "2013-01-01").map());
    when(allMothers.findByCaseId("entity id 1")).thenReturn(mother);

    FormSubmission submission =
        create()
            .withFormName("pnc_visit")
            .addFormField("pncVisitDate", "2013-01-02")
            .withSubForm(
                new SubFormData("child_pnc_visit", Collections.<Map<String, String>>emptyList()))
            .build();
    service.pncVisitHappened(submission);

    Mother updatedMother =
        new Mother("mother id 1", "ec id 1", "TC1")
            .withDetails(
                EasyMap.create("some-key", "some-value")
                    .put("pncVisitDates", "2013-01-01 2013-01-02")
                    .map())
            .withPNCVisits(
                asList(
                    new PNCVisit()
                        .withDate("2013-01-02")
                        .withChildrenDetails(Collections.<Map<String, String>>emptyList())));
    verify(allMothers).update(updatedMother);
  }
  @Test
  public void shouldDoReportingWhenPNCIsClosed() {
    when(allMothers.findByCaseId("entity id 1"))
        .thenReturn(new Mother("entity id 1", "ec entity id 1", "thayi 1"));
    when(reportFieldsDefinition.get("pnc_close")).thenReturn(asList("some-key"));
    FormSubmission submission =
        create().withFormName("pnc_close").addFormField("some-key", "some-value").build();

    service.close(submission);

    verify(motherReportingService).closePNC(new SafeMap(mapOf("some-key", "some-value")));
  }
  @Test
  public void shouldReportPNCVisit() throws Exception {
    when(reportFieldsDefinition.get("pnc_visit")).thenReturn(asList("some-key"));
    when(allMothers.findByCaseId("entity id 1"))
        .thenReturn(new Mother("mother id 1", "ec id 1", "TC1"));

    FormSubmission submission =
        create()
            .withFormName("pnc_visit")
            .addFormField("some-key", "value")
            .withSubForm(
                new SubFormData("child_pnc_visit", Collections.<Map<String, String>>emptyList()))
            .build();
    service.pncVisitHappened(submission);

    SafeMap reportFields = new SafeMap(mapOf("some-key", "value"));
    verify(motherReportingService).pncVisitHappened(reportFields);
  }
  @Test
  public void shouldReportPNCRegistrationOA() throws Exception {
    when(reportFieldsDefinition.get("pnc_registration_oa")).thenReturn(asList("some-key"));
    when(allMothers.findByEcCaseId("entity id 1"))
        .thenReturn(asList(new Mother("entity id 1", "ec id 1", "tc 1")));
    when(allEligibleCouples.findByCaseId("ec id 1"))
        .thenReturn(new EligibleCouple("ec id 1", "123"));

    FormSubmission submission =
        create()
            .withFormName("pnc_registration_oa")
            .addFormField("some-key", "value")
            .withSubForm(
                new SubFormData(
                    "child_registration_oa", Collections.<Map<String, String>>emptyList()))
            .build();
    service.pncRegistrationOA(submission);

    SafeMap reportFields = new SafeMap(mapOf("some-key", "value"));
    verify(motherReportingService).pncRegistrationOA(reportFields);
  }