use of org.hl7.fhir.r4.model.Medication in project openmrs-module-fhir2 by openmrs.
the class MedicationSearchQueryTest method searchForMedications_shouldSearchMedicationsByIngredientCode.
@Test
public void searchForMedications_shouldSearchMedicationsByIngredientCode() {
TokenAndListParam ingredientCode = new TokenAndListParam();
ingredientCode.addAnd(new TokenOrListParam().addOr(new TokenParam().setValue(INGREDIENT_CODE_UUID)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.INGREDIENT_SEARCH_HANDLER, ingredientCode);
IBundleProvider result = search(theParams);
List<Medication> resultList = get(result);
assertThat(result, notNullValue());
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getIngredientFirstRep().getItemCodeableConcept().getCodingFirstRep().getCode(), equalTo(INGREDIENT_CODE_UUID));
}
use of org.hl7.fhir.r4.model.Medication in project openmrs-module-fhir2 by openmrs.
the class MedicationTranslatorImplTest method toOpenmrsType_shouldNotRetireDrugIfMedicationInActive.
@Test
public void toOpenmrsType_shouldNotRetireDrugIfMedicationInActive() {
Medication medication = new Medication();
medication.setStatus(Medication.MedicationStatus.ACTIVE);
medicationTranslator.toOpenmrsType(drug, medication);
assertThat(drug, notNullValue());
assertThat(drug.getRetired(), equalTo(false));
}
use of org.hl7.fhir.r4.model.Medication in project openmrs-module-fhir2 by openmrs.
the class MedicationTranslatorImplTest method toOpenmrsType_shouldTranslateIdToUuid.
@Test
public void toOpenmrsType_shouldTranslateIdToUuid() {
Medication medication = new Medication();
medication.setId(MEDICATION_UUID);
medicationTranslator.toOpenmrsType(drug, medication);
assertThat(drug, notNullValue());
assertThat(drug.getUuid(), notNullValue());
assertThat(drug.getUuid(), equalTo(MEDICATION_UUID));
}
use of org.hl7.fhir.r4.model.Medication in project openmrs-module-fhir2 by openmrs.
the class MedicationTranslatorImplTest method toFhirResource_shouldTranslateUuidToId.
@Test
public void toFhirResource_shouldTranslateUuidToId() {
drug.setUuid(MEDICATION_UUID);
Medication medication = medicationTranslator.toFhirResource(drug);
assertThat(medication, notNullValue());
assertThat(medication.getId(), equalTo(MEDICATION_UUID));
}
use of org.hl7.fhir.r4.model.Medication in project openmrs-module-fhir2 by openmrs.
the class MedicationTranslatorImplTest method toOpenmrsType_shouldReturnNullWhenCalledWithNullDose.
@Test
public void toOpenmrsType_shouldReturnNullWhenCalledWithNullDose() {
Medication medication = new Medication();
drug.setDosageForm(null);
medicationTranslator.toOpenmrsType(drug, medication);
assertThat(drug.getDosageForm(), nullValue());
}
Aggregations