Example #1
0
  @Test
  public void shouldGetVisitsByPlannedDate() throws IOException, InterruptedException {
    addTestVisitsToDB();
    String jsonInput =
        getVisitsByLookup(
            "{\"motechProjectedDate\":\"201" + "4-10-21\"}",
            "Find Visit By Planned Visit Date",
            1,
            5);

    List<Visit> visits = deserializeVisits(jsonInput).getRows();
    assertEquals(1, visits.size());

    VisitUtils.checkVisitFields(testVisits.get(3), visits.get(0));
  }
Example #2
0
  @Test
  public void shouldGetVisitsByPlannedDateRangeAndType() throws IOException, InterruptedException {
    addTestVisitsToDB();
    String jsonInput =
        getVisitsByLookup(
            "{\"motechProjectedDate\":{\"min\":\"2014-10-20\",\"max\":\"2014-10-21\"},\"type\":\"PRIME_VACCINATION_FOLLOW_UP_VISIT\"}",
            "Find Visits By Planned Visit Date Range And Type",
            1,
            5);

    List<Visit> visits = deserializeVisits(jsonInput).getRows();
    assertEquals(1, visits.size());

    VisitUtils.checkVisitFields(testVisits.get(3), visits.get(0));
  }
Example #3
0
  private void resetTestFields() {
    firstSubject =
        new Subject(
            "1000000161",
            "Michal",
            "Abacki",
            "Cabacki",
            "729402018364",
            "address",
            Language.English,
            "community",
            "B05-SL10001");

    secondSubject =
        new Subject(
            "1000000162",
            "Rafal",
            "Dabacki",
            "Ebacki",
            "44443333222",
            "address1",
            Language.Susu,
            "community",
            "B05-SL10001");

    firstSubject.setDateOfBirth(LocalDate.parse("1967-09-17", formatter));
    firstSubject.setGender(Gender.Male);
    firstSubject.setPrimerVaccinationDate(LocalDate.parse("2014-10-17", formatter));
    firstSubject.setBoosterVaccinationDate(LocalDate.parse("2014-10-20", formatter));

    secondSubject.setDateOfBirth(LocalDate.parse("2005-08-04", formatter));
    secondSubject.setGender(Gender.Male);
    secondSubject.setPrimerVaccinationDate(LocalDate.parse("2014-10-17", formatter));
    secondSubject.setBoosterVaccinationDate(LocalDate.parse("2014-10-20", formatter));

    testVisits.add(
        VisitUtils.createVisit(
            firstSubject,
            VisitType.SCREENING,
            LocalDate.parse("2014-10-17", formatter),
            LocalDate.parse("2014-10-17", formatter),
            "owner"));

    testVisits.add(
        VisitUtils.createVisit(
            firstSubject,
            VisitType.PRIME_VACCINATION_FOLLOW_UP_VISIT,
            LocalDate.parse("2014-10-19", formatter),
            LocalDate.parse("2014-10-19", formatter),
            "owner"));

    testVisits.add(
        VisitUtils.createVisit(
            secondSubject,
            VisitType.SCREENING,
            LocalDate.parse("2014-10-19", formatter),
            LocalDate.parse("2014-10-19", formatter),
            "owner"));

    testVisits.add(
        VisitUtils.createVisit(
            secondSubject,
            VisitType.PRIME_VACCINATION_FOLLOW_UP_VISIT,
            LocalDate.parse("2014-10-21", formatter),
            LocalDate.parse("2014-10-21", formatter),
            "owner"));

    testVisits.add(
        VisitUtils.createVisit(
            firstSubject,
            VisitType.BOOST_VACCINATION_DAY,
            LocalDate.parse("2014-10-17", formatter),
            LocalDate.parse("2014-10-17", formatter),
            "owner"));
  }