use of org.openmrs.person.PersonMergeLog in project openmrs-core by openmrs.
the class PersonServiceTest method getTestPersonMergeLog.
private PersonMergeLog getTestPersonMergeLog() {
PersonMergeLog personMergeLog = new PersonMergeLog();
personMergeLog.setLoser(new Person(1));
personMergeLog.setWinner(new Person(2));
PersonMergeLogData data = new PersonMergeLogData();
data.addCreatedAddress("1");
data.addCreatedAttribute("2");
data.addCreatedIdentifier("3");
data.addCreatedName("4");
data.addCreatedOrder("5");
data.addCreatedProgram("6");
data.addCreatedRelationship("7");
data.addMovedEncounter("8");
data.addMovedIndependentObservation("9");
data.addMovedUser("10");
data.addVoidedRelationship("11");
data.setPriorCauseOfDeath("test");
data.setPriorDateOfBirth(new Date());
data.setPriorDateOfBirthEstimated(true);
data.setPriorDateOfDeath(new Date());
data.setPriorGender("F");
personMergeLog.setPersonMergeLogData(data);
return personMergeLog;
}
use of org.openmrs.person.PersonMergeLog in project openmrs-core by openmrs.
the class PersonServiceTest method getPersonMergeLogByUuid_shouldRetrievePersonMergeLogWithoutDeserializingData.
/**
* @see PersonService#getPersonMergeLogByUuid(String,boolean)
*/
@Test
public void getPersonMergeLogByUuid_shouldRetrievePersonMergeLogWithoutDeserializingData() throws Exception {
PersonMergeLog personMergeLog = getTestPersonMergeLog();
PersonMergeLog persisted = Context.getPersonService().savePersonMergeLog(personMergeLog);
PersonMergeLog retrieved = Context.getPersonService().getPersonMergeLogByUuid(persisted.getUuid(), false);
Assert.assertNotNull("problem retrieving PersonMergeLog by UUID", retrieved);
}
use of org.openmrs.person.PersonMergeLog in project openmrs-core by openmrs.
the class PersonServiceTest method savePersonMergeLog_shouldRequireWinner.
/**
* @see PersonService#savePersonMergeLog(PersonMergeLog)
*/
@Test(expected = APIException.class)
public void savePersonMergeLog_shouldRequireWinner() throws Exception {
PersonMergeLog personMergeLog = getTestPersonMergeLog();
personMergeLog.setWinner(null);
Context.getPersonService().savePersonMergeLog(personMergeLog);
}
use of org.openmrs.person.PersonMergeLog in project openmrs-core by openmrs.
the class PersonServiceTest method savePersonMergeLog_shouldSavePersonMergeLog.
/**
* @see PersonService#savePersonMergeLog(PersonMergeLog)
*/
@Test
public void savePersonMergeLog_shouldSavePersonMergeLog() throws Exception {
PersonMergeLog personMergeLog = getTestPersonMergeLog();
try {
PersonMergeLog persisted = Context.getPersonService().savePersonMergeLog(personMergeLog);
Assert.assertNotNull("patientMergeLogId has not been set which indicates a problem saving the object", persisted.getPersonMergeLogId());
} catch (Exception ex) {
Assert.fail("should not fail when all required fields are set. " + ex.getMessage());
}
}
use of org.openmrs.person.PersonMergeLog in project openmrs-core by openmrs.
the class PersonServiceTest method getAllPersonMergeLogs_shouldRetrieveAllPersonMergeLogsFromTheModel.
/**
* @see PersonService#getAllPersonMergeLogs(boolean)
*/
@Test
public void getAllPersonMergeLogs_shouldRetrieveAllPersonMergeLogsFromTheModel() throws Exception {
PersonMergeLog personMergeLog = getTestPersonMergeLog();
Context.getPersonService().savePersonMergeLog(personMergeLog);
List<PersonMergeLog> result = Context.getPersonService().getAllPersonMergeLogs(false);
Assert.assertEquals("could not retrieve expected number of PersonMergeLog objects", 1, result.size());
}
Aggregations