PatientListServiceImpl implements PatientListService { @Override public PatientList getPatientList(Integer id) { return dao.getPatientList(id); }  @Override void setPatientListDAO(PatientListDAO dao); @Override PatientList savePatientList(PatientList patientList); @Override PatientList getPatientList(Integer id); @Override List<PatientList> getPatientListByName(String name); @Override PatientList getPatientListByUuid(String uuid); @Override List<PatientList> getPatientListByEncounterType(EncounterType encounterType); @Override List<PatientList> getAllPatientList(boolean includeRetired); @Override List<Encounter> getEncountersInPatientList(PatientList patientList); @Override List<Patient> getPatientsInPatientList(PatientList patientList); @Override PatientList updatePatientList(PatientList patientList); @Override void deletePatientList(PatientList patientList); @Override void onStartup(); @Override void onShutdown();  }
@Test public void testGetPatientListShouldUsePrivileges() { Context.getUserContext().getAuthenticatedUser().removeRole(Context.getUserService().getRole("System Developer")); Context.getUserContext().removeProxyPrivilege("View Patient Lists"); Integer patientListId = 1; PatientList result = null; try { result = s.getPatientList(patientListId); fail("No privileges required for getPatientList"); } catch (APIAuthenticationException e) { Context.getUserContext().addProxyPrivilege("View Patient Lists"); result = s.getPatientList(patientListId); } }
@Test public void testGetPatientListShouldReturnPatientList() { Integer patientListId = 1; PatientList result = s.getPatientList(patientListId); String name = result.getName(); assertEquals("TestList1", name); }