use of org.openmrs.module.fhir2.api.FhirGlobalPropertyService in project openmrs-module-fhir2 by openmrs.
the class MockedGlobalPropertyServiceConfiguration method getFhirGlobalPropertyService.
@Bean
@Primary
public FhirGlobalPropertyService getFhirGlobalPropertyService() {
FhirGlobalPropertyService globalPropertyService = Mockito.mock(FhirGlobalPropertyService.class);
when(globalPropertyService.getGlobalProperty("default_locale", "en_GB")).thenReturn("en_GB");
return globalPropertyService;
}
use of org.openmrs.module.fhir2.api.FhirGlobalPropertyService in project openmrs-module-fhir2 by openmrs.
the class FhirTaskServiceImplTest method searchForTasks_shouldReturnTasksByParameters.
@Test
public void searchForTasks_shouldReturnTasksByParameters() {
List<FhirTask> openmrsTasks = new ArrayList<>();
FhirTask openmrsTask = new FhirTask();
openmrsTask.setUuid(TASK_UUID);
openmrsTasks.add(openmrsTask);
Task task = new Task();
task.setId(TASK_UUID);
SearchParameterMap theParams = new SearchParameterMap();
when(dao.getSearchResultUuids(any())).thenReturn(Collections.singletonList(TASK_UUID));
when(dao.getSearchResults(any(), any())).thenReturn(openmrsTasks);
when(searchQuery.getQueryResults(any(), any(), any(), any())).thenReturn(new SearchQueryBundleProvider<>(theParams, dao, translator, fhirGlobalPropertyService, searchQueryInclude));
when(searchQueryInclude.getIncludedResources(any(), any())).thenReturn(Collections.emptySet());
when(translator.toFhirResource(openmrsTask)).thenReturn(task);
IBundleProvider results = fhirTaskService.searchForTasks(null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasItem(hasProperty("id", equalTo(TASK_UUID))));
}
use of org.openmrs.module.fhir2.api.FhirGlobalPropertyService in project openmrs-module-fhir2 by openmrs.
the class FhirGlobalPropertyServiceImplTest method shouldReturnStringGlobalPropertyValueWhenPropertyMatched.
@Test
public void shouldReturnStringGlobalPropertyValueWhenPropertyMatched() {
FhirGlobalPropertyService globalPropertyService = mock(FhirGlobalPropertyService.class);
when(globalPropertyService.getGlobalProperty(DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_STRING_VALUE)).thenReturn("100");
String result = globalPropertyService.getGlobalProperty(DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_STRING_VALUE);
assertThat(result, notNullValue());
assertThat(result, is("100"));
}
use of org.openmrs.module.fhir2.api.FhirGlobalPropertyService in project openmrs-module-fhir2 by openmrs.
the class FhirGlobalPropertyServiceImplTest method shouldReturnIntegerGlobalPropertyValueWhenPropertyMatched.
@Test
public void shouldReturnIntegerGlobalPropertyValueWhenPropertyMatched() {
FhirGlobalPropertyService globalPropertyService = mock(FhirGlobalPropertyService.class);
when(globalPropertyService.getGlobalProperty(DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_INTEGER_VALUE)).thenReturn(100);
int result = globalPropertyService.getGlobalProperty(DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_INTEGER_VALUE);
assertThat(result, notNullValue());
assertThat(result, is(100));
}
Aggregations