* Test inList parts of getEncountersInPatientList method, of class
* PatientListServiceImpl.
*/
@Test
public void testGetEncountersInPatientListShouldOnlyReturnEncountersAccordingToInList() {
PatientList p = new PatientList();
PatientList p2 = new PatientList();
p.setCreator(Context.getUserContext().getAuthenticatedUser());
p.setName("GetPatientsTestList");
p2.setName("TestPatientsNotInList");
//setting start + end dates for inList test
p2.setSearchQuery("?encounterType=61ae96f4-6afe-4351-b6f8-cd4fc383cce1"
+ "&startDate=2008-08-14T00:00:0&endDate=2008-08-016T00:00:00");
s.savePatientList(p2);
p.setSearchQuery("?encounterType=61ae96f4-6afe-4351-b6f8-cd4fc383cce1"
+ "&startDate=2000-01-01T00:00:00&endDate=2012-01-02T00:00:00");
Context.getUserContext().addProxyPrivilege("Add Patient Lists");
List<Encounter> encs = s.getEncountersInPatientList(p);
List<Encounter> encs2 = null;
int originalLength = encs.size();
p.setSearchQuery("?encounterType=61ae96f4-6afe-4351-b6f8-cd4fc383cce1"
+ "&startDate=2000-01-01T00:00:00&endDate=2012-01-02T00:00:00&inList=" + p2.getUuid());
encs = s.getEncountersInPatientList(p);
encs2 = s.getEncountersInPatientList(p2);
assertEquals(encs.size(), originalLength - encs2.size());
}