Skip to content

Commit

Permalink
RA-950: Add LastVisit and EditVisit require an EndDate
Browse files Browse the repository at this point in the history
  • Loading branch information
reagan committed Jan 24, 2020
1 parent efd9c36 commit 32f0d66
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ public void test_shouldCreateNewRetrospectiveVisit_whenNoStopDateSpecified() thr

// should round to the time components to the start and end of the days, respectively
Date expectedStartDate = new DateTime(2012, 1, 1, 0, 0, 0, 0).toDate();
Date expectedStopDate = new DateTime(2012, 1, 1, 23, 59, 59, 999).toDate();

Visit visit = createVisit();

when(adtService.createRetrospectiveVisit(patient, location, expectedStartDate, expectedStopDate)).thenReturn(new VisitDomainWrapper(visit));
when(adtService.createRetrospectiveVisit(patient, location, expectedStartDate, null)).thenReturn(new VisitDomainWrapper(visit));

SimpleObject result = (SimpleObject) controller.create(adtService, patient, location, startDate, null, request, ui);

Expand All @@ -118,7 +117,7 @@ public void test_shouldReturnConflictingVisits() throws Exception {
Patient patient = new Patient();
Location location = new Location();
Date startDate = new DateTime(2012, 1, 1, 12, 12, 12).toDate();

Date stopDate = startDate;
// should round to the time components to the start and end of the days, respectively
Date expectedStartDate = new DateTime(2012, 1, 1, 0, 0, 0, 0).toDate();
Date expectedStopDate = new DateTime(2012, 1, 1, 23, 59, 59, 999).toDate();
Expand All @@ -135,7 +134,7 @@ public void test_shouldReturnConflictingVisits() throws Exception {

when(ui.format(any())).thenReturn("someDate");

List<SimpleObject> result = (List<SimpleObject>) controller.create(adtService, patient, location, startDate, null, request, ui);
List<SimpleObject> result = (List<SimpleObject>) controller.create(adtService, patient, location, startDate, stopDate, request, ui);

assertThat(result.size(), is(1));
assertThat(result.get(0).toJson(), is("{\"startDate\":\"someDate\",\"stopDate\":\"someDate\",\"id\":null,\"uuid\":\"" + conflictingVisit.getUuid() + "\"}"));
Expand Down

0 comments on commit 32f0d66

Please sign in to comment.