/** * @see org.openmrs.api.PatientService#getAllPatients() */ @Override @Transactional(readOnly = true) public List<Patient> getAllPatients() throws APIException { return Context.getPatientService().getAllPatients(false); }
@Test public void getAllPatients_shouldFetchVoidedPatientsWhenGivenIncludeVoidedIsTrue() throws Exception { List<Patient> allPatients = patientService.getAllPatients(true); // there are 1 voided and 4 nonvoided patients in // standardTestDataset.xml assertEquals(6, allPatients.size()); }
@Test public void getAllPatients_shouldFetchAllNonVoidedPatients() throws Exception { List<Patient> allPatients = patientService.getAllPatients(); // there are 1 voided and 4 nonvoided patients in // standardTestDataset.xml assertEquals(4, allPatients.size()); }
@Test public void getAllPatients_shouldFetchNonVoidedPatientsWhenGivenIncludeVoidedIsFalse() throws Exception { List<Patient> allPatients = patientService.getAllPatients(false); // there are 1 voided and 4 nonvoided patients in // standardTestDataset.xml assertEquals(4, allPatients.size()); }
@Override public List<MRSPatient> getAllPatients() { List<org.openmrs.Patient> patientsOpenMRS = patientService.getAllPatients(); List<MRSPatient> patients = new ArrayList<>(); for (org.openmrs.Patient patient : patientsOpenMRS) { patients.add(getMrsPatient(patient)); } return patients; }
List<Patient> allPatientsSet = Context.getPatientService().getAllPatients(); assertEquals(1, allPatientsSet.size());
/** * @see MainResourceControllerTest#getAllCount() */ @Override public long getAllCount() { return Context.getPatientService().getAllPatients(false).size(); }
@Test public void shouldCreateAPatient() throws Exception { long originalCount = service.getAllPatients().size(); String json = "{ \"person\": \"ba1b19c2-3ed6-4f63-b8c0-f762dc8d7562\", " + "\"identifiers\": [{ \"identifier\":\"abc123ez\", " + "\"identifierType\":\"2f470aa8-1d73-43b7-81b5-01f0c0dfa53c\", " + "\"location\":\"9356400c-a5a2-4532-8f2b-2361b3446eb8\", " + "\"preferred\": true }] }"; SimpleObject newPatient = deserialize(handle(newPostRequest(getURI(), json))); assertNotNull(PropertyUtils.getProperty(newPatient, "uuid")); assertEquals(originalCount + 1, service.getAllPatients().size()); }
@Test public void shouldCreatePersonAndPatient() throws Exception { long originalCount = service.getAllPatients().size(); String json = "{ \"identifiers\": [{ \"identifier\":\"abc123ez\", " + "\"identifierType\":\"2f470aa8-1d73-43b7-81b5-01f0c0dfa53c\", " + "\"location\":\"9356400c-a5a2-4532-8f2b-2361b3446eb8\", " + "\"preferred\": true }], " + "\"person\": { " + "\"gender\": \"M\", " + "\"age\": 47, " + "\"birthdate\": \"1970-01-01T00:00:00.000+0100\", " + "\"birthdateEstimated\": false, " + "\"dead\": false, " + "\"deathDate\": null, " + "\"causeOfDeath\": null, " + "\"names\": [{\"givenName\": \"Thomas\", \"familyName\": \"Smith\"}] " + "}}"; SimpleObject newPatient = deserialize(handle(newPostRequest(getURI(), json))); assertNotNull(PropertyUtils.getProperty(newPatient, "uuid")); assertEquals(originalCount + 1, service.getAllPatients().size()); }
int count = Context.getPatientService().getAllPatients().size(); Assert.assertEquals((count + 1), Context.getPatientService().getAllPatients().size());