use of org.openmrs.RelationshipType in project openmrs-core by openmrs.
the class PersonServiceTest method saveRelationshipType_shouldFailIfTheDescriptionIsNotSpecified.
/**
* @see PersonService#saveRelationshipType(RelationshipType)
*/
@Test(expected = APIException.class)
public void saveRelationshipType_shouldFailIfTheDescriptionIsNotSpecified() throws Exception {
RelationshipType relationshipType = new RelationshipType();
relationshipType.setaIsToB("Sister");
relationshipType.setbIsToA("Brother");
personService.saveRelationshipType(relationshipType);
}
use of org.openmrs.RelationshipType in project openmrs-core by openmrs.
the class PersonServiceTest method getRelationshipMap_shouldReturnEmptyMapWhenNoRelationshipHasTheMatchingRelationshipType.
/**
* @see PersonService#getRelationshipMap(RelationshipType)
*/
@Test
public void getRelationshipMap_shouldReturnEmptyMapWhenNoRelationshipHasTheMatchingRelationshipType() throws Exception {
executeDataSet("org/openmrs/api/include/PersonServiceTest-createRetiredRelationship.xml");
PersonService personService = Context.getPersonService();
RelationshipType relationshipType = personService.getRelationshipType(15);
Map<Person, List<Person>> relationshipMap = personService.getRelationshipMap(relationshipType);
Assert.assertNotNull(relationshipMap);
assertTrue("There should be no element in the map", relationshipMap.isEmpty());
}
use of org.openmrs.RelationshipType in project openmrs-core by openmrs.
the class PersonServiceTest method getRelationships3_shouldFetchRelationshipsMatchingTheGivenRelType.
/**
* @see PersonService#getRelationships(Person,Person,RelationshipType,Date,Date)
*/
@Test
public void getRelationships3_shouldFetchRelationshipsMatchingTheGivenRelType() throws Exception {
PersonService personService = Context.getPersonService();
RelationshipType relationshipType = personService.getRelationshipType(1);
List<Relationship> relationships = personService.getRelationships(null, null, relationshipType, new Date(), new Date());
Assert.assertNotNull(relationships);
assertTrue("There should be relationship found given the relationship type", relationships.size() > 0);
}
use of org.openmrs.RelationshipType in project openmrs-core by openmrs.
the class PersonServiceTest method getRelationshipType_shouldReturnRelationshipTypeWithTheGivenRelationshipTypeId.
/**
* @see PersonService#getRelationshipType(Integer)
*/
@Test
public void getRelationshipType_shouldReturnRelationshipTypeWithTheGivenRelationshipTypeId() throws Exception {
RelationshipType relationshipType = Context.getPersonService().getRelationshipType(1);
Assert.assertNotNull(relationshipType);
assertTrue("Expecting the return is of a relationship type", relationshipType.getClass().equals(RelationshipType.class));
}
use of org.openmrs.RelationshipType in project openmrs-core by openmrs.
the class PersonServiceTest method getRelationshipTypeByName_shouldReturnNullWhenNoRelationshipTypeMatchTheGivenName.
/**
* @see PersonService#getRelationshipTypeByName(String)
*/
@Test
public void getRelationshipTypeByName_shouldReturnNullWhenNoRelationshipTypeMatchTheGivenName() throws Exception {
RelationshipType relationshipType = Context.getPersonService().getRelationshipTypeByName("Supervisor");
Assert.assertNull(relationshipType);
}
Aggregations