use of org.openmrs.PatientIdentifierType 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.PatientIdentifierType in project openmrs-core by openmrs.
the class PatientServiceTest method getPatientIdentifierType_shouldFetchPatientIdentifierWithGivenPatientIdentifierTypeId.
/**
* @see PatientService#getPatientIdentifierType(Integer)
*/
@Test
public void getPatientIdentifierType_shouldFetchPatientIdentifierWithGivenPatientIdentifierTypeId() throws Exception {
PatientIdentifierType identifierType = Context.getPatientService().getPatientIdentifierType(1);
Assert.assertNotNull(identifierType);
Assert.assertTrue(identifierType.getClass().isAssignableFrom(PatientIdentifierType.class));
}
use of org.openmrs.PatientIdentifierType 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.PatientIdentifierType in project openmrs-core by openmrs.
the class PatientServiceTest method purgePatientIdentifierType_shouldThrowErrorWhenTryingToDeleteAPatientIdentifierTypeWhilePatientIdentifierTypesAreLocked.
@Test(expected = PatientIdentifierTypeLockedException.class)
public void purgePatientIdentifierType_shouldThrowErrorWhenTryingToDeleteAPatientIdentifierTypeWhilePatientIdentifierTypesAreLocked() throws Exception {
PatientService ps = Context.getPatientService();
createPatientIdentifierTypeLockedGPAndSetValue("true");
PatientIdentifierType pit = ps.getPatientIdentifierType(1);
ps.purgePatientIdentifierType(pit);
}
use of org.openmrs.PatientIdentifierType in project openmrs-core by openmrs.
the class PatientServiceTest method getPatientIdentifierTypeByUuid_shouldFindObjectGivenValidUuid.
/**
* @see PatientService#getPatientIdentifierTypeByUuid(String)
*/
@Test
public void getPatientIdentifierTypeByUuid_shouldFindObjectGivenValidUuid() throws Exception {
String uuid = "1a339fe9-38bc-4ab3-b180-320988c0b968";
PatientIdentifierType patientIdentifierType = Context.getPatientService().getPatientIdentifierTypeByUuid(uuid);
Assert.assertEquals(1, (int) patientIdentifierType.getPatientIdentifierTypeId());
}
Aggregations