예제 #1
0
  private RegistrationChildForm getExpectedForm(String caseId) {
    ChildCase expectedChildCase = new ChildCase();
    expectedChildCase.setCaseId(caseId);

    Flw expectedFlw = new Flw();
    expectedFlw.setFlwId("89fda0284e008d2e0c980fb13fa0e5bb");

    RegistrationChildForm expectedChildForm = new RegistrationChildForm();
    expectedChildForm.setChildCase(expectedChildCase);
    expectedChildForm.setFlw(expectedFlw);
    expectedChildForm.setDateModified(
        new DateTime(2013, 3, 3, 10, 38, 52, 804, DateTimeZone.forOffsetHoursMinutes(5, 30))
            .toDate());
    expectedChildForm.setChildName("suraj");
    expectedChildForm.setBirthStatus("healthy");
    expectedChildForm.setInstanceId("ff2eb090-03a9-4f23-afed-cf6012784c55");
    expectedChildForm.setTimeStart(
        new DateTime(2013, 3, 3, 10, 31, 51, 45, DateTimeZone.forOffsetHoursMinutes(5, 30))
            .toDate());
    expectedChildForm.setTimeEnd(
        new DateTime(2013, 3, 3, 10, 38, 52, 804, DateTimeZone.forOffsetHoursMinutes(5, 30))
            .toDate());

    return expectedChildForm;
  }
예제 #2
0
  @Test
  public void shouldSaveMotherFormForExistingCase() {
    MotherCase motherCase = new MotherCase();
    motherCase.setCaseId("94d5374f-290e-409f-bc57-86c2e4bcc43f");
    template.save(motherCase);
    Flw flw = new Flw();
    flw.setFlwId("89fda0284e008d2e0c980fb13fa0e5bb");
    template.save(flw);
    Map<String, String> motherForm = motherFormValues(motherCase.getCaseId(), flw.getFlwId());

    careService.processAndSaveForms(motherForm, new ArrayList<Map<String, String>>());

    List<MotherCase> persistedMotherCases = template.loadAll(MotherCase.class);
    assertEquals(1, persistedMotherCases.size());
    List<NewForm> newForms = template.loadAll(NewForm.class);
    assertEquals(1, newForms.size());
    NewForm expectedForm = expectedForm(motherCase, flw);
    assertReflectionEqualsWithIgnore(
        expectedForm, newForms.get(0), new String[] {"id", "creationTime", "lastModifiedTime"});
  }