use of org.openmrs.Location in project openmrs-core by openmrs.
the class LocationServiceTest method saveLocationTag_shouldThrowAPIExceptionIfTagHasNoName.
/**
* @see LocationService#saveLocationTag(LocationTag)
*/
@Test(expected = APIException.class)
public void saveLocationTag_shouldThrowAPIExceptionIfTagHasNoName() {
LocationTag tagWithoutName = new LocationTag();
Location location = new Location();
location.setName("Some name");
location.setDescription("Some description");
location.addTag(tagWithoutName);
Context.getLocationService().saveLocation(location);
}
use of org.openmrs.Location in project openmrs-core by openmrs.
the class PatientServiceTest method savePatient_shouldNotThrowANonUniqueObjectExceptionWhenCalledWithAHandConstructedPatient.
/**
* Regression test for http://dev.openmrs.org/ticket/1375
*
* @see PatientService#savePatient(Patient)
*/
@Test
public void savePatient_shouldNotThrowANonUniqueObjectExceptionWhenCalledWithAHandConstructedPatient() throws Exception {
Patient patient = new Patient();
patient.setGender("M");
patient.setPatientId(2);
// patient.setCreator(new User(1));
// patient.setDateCreated date_created="2005-09-22 00:00:00.0"
// changed_by="1" date_changed="2008-08-18 12:29:59.0"
patient.addName(new PersonName("This", "Isa", "Test"));
PatientIdentifier patientIdentifier = new PatientIdentifier("101-6", new PatientIdentifierType(1), new Location(1));
patientIdentifier.setPreferred(true);
patient.addIdentifier(patientIdentifier);
Context.getPatientService().savePatient(patient);
}
use of org.openmrs.Location 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.Location in project openmrs-core by openmrs.
the class PatientDAOTest method getPatientIdentifiers_shouldLimitByResultsByLocation.
@Test
public void getPatientIdentifiers_shouldLimitByResultsByLocation() {
// there is only one identifier in the test database for location 3
Location location = Context.getLocationService().getLocation(3);
List<PatientIdentifier> patientIdentifiers = dao.getPatientIdentifiers(null, new ArrayList<>(), Collections.singletonList(location), new ArrayList<>(), null);
Assert.assertEquals(1, patientIdentifiers.size());
Assert.assertEquals("12345K", patientIdentifiers.get(0).getIdentifier());
}
use of org.openmrs.Location in project openmrs-core by openmrs.
the class BaseUnretireHandlerTest method handle_shouldUnsetTheDateRetired.
/**
* @see BaseUnretireHandler#handle(Retireable,User,Date,String)
*/
@Test
public void handle_shouldUnsetTheDateRetired() {
UnretireHandler<Retireable> handler = new BaseUnretireHandler();
Retireable retireable = new Location();
retireable.setRetired(true);
retireable.setDateRetired(new Date());
handler.handle(retireable, null, null, null);
Assert.assertNull(retireable.getDateRetired());
}
Aggregations