use of org.openmrs.PatientIdentifier in project openmrs-core by openmrs.
the class PatientServiceTest method getPatientIdentifierByUuid_shouldFetchPatientIdentifierWithGivenUuid.
/**
* @see PatientService#getPatientIdentifierByUuid(String)
*/
@Test
public void getPatientIdentifierByUuid_shouldFetchPatientIdentifierWithGivenUuid() throws Exception {
String uuid = "ff41928c-3bca-48d9-a4dc-9198f6b2873b";
PatientIdentifier patientIdentifier = Context.getPatientService().getPatientIdentifierByUuid(uuid);
Assert.assertEquals(1, (int) patientIdentifier.getPatientIdentifierId());
}
use of org.openmrs.PatientIdentifier in project openmrs-core by openmrs.
the class PatientServiceTest method isIdentifierInUseByAnotherPatient_shouldReturnFalseWhenPatientIdentifierDoesNotContainAPatientAndNoPatientHasThisId.
/**
* @see PatientService#isIdentifierInUseByAnotherPatient(PatientIdentifier)
*/
@Test
public void isIdentifierInUseByAnotherPatient_shouldReturnFalseWhenPatientIdentifierDoesNotContainAPatientAndNoPatientHasThisId() throws Exception {
PatientIdentifierType pit = patientService.getPatientIdentifierType(1);
PatientIdentifier patientIdentifier = new PatientIdentifier("Nobody could possibly have this identifier", pit, null);
Assert.assertFalse(patientService.isIdentifierInUseByAnotherPatient(patientIdentifier));
}
use of org.openmrs.PatientIdentifier in project openmrs-core by openmrs.
the class PatientServiceTest method savePatient_shouldNotThrowNonUniqueObjectExceptionWhenCalledWithPersonPromotedToPatient.
/**
* https://tickets.openmrs.org/browse/TRUNK-3728
*
* @see PatientService#savePatient(Patient)
*/
@Test
public void savePatient_shouldNotThrowNonUniqueObjectExceptionWhenCalledWithPersonPromotedToPatient() throws Exception {
Person person = personService.getPerson(1);
Patient patient = patientService.getPatientOrPromotePerson(person.getPersonId());
PatientIdentifier patientIdentifier = new PatientIdentifier("some identifier", new PatientIdentifierType(2), new Location(1));
patientIdentifier.setPreferred(true);
patient.addIdentifier(patientIdentifier);
patientService.savePatient(patient);
}
use of org.openmrs.PatientIdentifier in project openmrs-core by openmrs.
the class PatientServiceTest method purgePatientIdentifier_shouldDeletePatientIdentifierFromDatabase.
@Test
public void purgePatientIdentifier_shouldDeletePatientIdentifierFromDatabase() throws Exception {
PatientIdentifier patientIdentifier = patientService.getPatientIdentifier(7);
patientService.purgePatientIdentifier(patientIdentifier);
Assert.assertNull(patientService.getPatientIdentifier(7));
}
use of org.openmrs.PatientIdentifier in project openmrs-core by openmrs.
the class PatientServiceTest method isIdentifierInUseByAnotherPatient_shouldReturnTrueWhenPatientIdentifierDoesNotContainAPatientAndAPatientHasThisId.
/**
* @see PatientService#isIdentifierInUseByAnotherPatient(PatientIdentifier)
*/
@Test
public void isIdentifierInUseByAnotherPatient_shouldReturnTrueWhenPatientIdentifierDoesNotContainAPatientAndAPatientHasThisId() throws Exception {
PatientIdentifierType pit = patientService.getPatientIdentifierType(1);
PatientIdentifier patientIdentifier = new PatientIdentifier("7TU-8", pit, null);
Assert.assertTrue(patientService.isIdentifierInUseByAnotherPatient(patientIdentifier));
}
Aggregations