use of org.hl7.fhir.r4.model.Group in project openmrs-module-fhir2 by openmrs.
the class FhirGroupServiceImplTest method getGroupByUuid_shouldGetGroupByUuid.
@Test
public void getGroupByUuid_shouldGetGroupByUuid() {
when(dao.get(COHORT_UUID)).thenReturn(cohort);
when(translator.toFhirResource(cohort)).thenReturn(group);
Group group = groupService.get(COHORT_UUID);
assertThat(group, notNullValue());
assertThat(group.getId(), notNullValue());
assertThat(group.getId(), equalTo(COHORT_UUID));
}
use of org.hl7.fhir.r4.model.Group in project openmrs-module-fhir2 by openmrs.
the class FhirGroupServiceImplTest method updateGroupShouldThrowInvalidRequestExceptionIfIdIsNull.
@Test(expected = InvalidRequestException.class)
public void updateGroupShouldThrowInvalidRequestExceptionIfIdIsNull() {
Group group = new Group();
group.setId(COHORT_UUID);
groupService.update(null, group);
}
use of org.hl7.fhir.r4.model.Group in project openmrs-module-fhir2 by openmrs.
the class FhirGroupServiceImplTest method updateGroupShouldThrowResourceNotFoundException.
@Test(expected = ResourceNotFoundException.class)
public void updateGroupShouldThrowResourceNotFoundException() {
Group group = new Group();
group.setId(COHORT_UUID);
groupService.update(COHORT_UUID, group);
}
use of org.hl7.fhir.r4.model.Group in project openmrs-module-fhir2 by openmrs.
the class FhirGroupServiceImplTest method setup.
@Before
public void setup() {
groupService = new FhirGroupServiceImpl() {
@Override
protected void validateObject(Cohort object) {
}
};
groupService.setDao(dao);
groupService.setTranslator(translator);
groupService.setSearchQuery(searchQuery);
groupService.setSearchQueryInclude(searchQueryInclude);
group = new Group();
group.setId(COHORT_UUID);
cohort = new Cohort();
cohort.setUuid(COHORT_UUID);
}
use of org.hl7.fhir.r4.model.Group in project openmrs-module-fhir2 by openmrs.
the class FhirGroupServiceImplTest method shouldSaveNewGroup.
@Test
public void shouldSaveNewGroup() {
Cohort cohort = new Cohort();
cohort.setUuid(COHORT_UUID);
Group group = new Group();
group.setId(COHORT_UUID);
when(translator.toFhirResource(cohort)).thenReturn(group);
when(translator.toOpenmrsType(group)).thenReturn(cohort);
when(dao.createOrUpdate(cohort)).thenReturn(cohort);
Group result = groupService.create(group);
assertThat(result, notNullValue());
assertThat(result.getId(), equalTo(COHORT_UUID));
}
Aggregations