Search in sources :

Example 1 with FreeTextDosingInstructions

use of org.openmrs.FreeTextDosingInstructions in project openmrs-core by openmrs.

the class DrugOrderValidatorTest method validate_shouldPassIfConceptIsNullAndDrugIsSet.

/**
 * @see DrugOrderValidator#validate(Object, org.springframework.validation.Errors)
 */
@Test
public void validate_shouldPassIfConceptIsNullAndDrugIsSet() {
    DrugOrder order = new DrugOrder();
    order.setPatient(Context.getPatientService().getPatient(7));
    order.setCareSetting(Context.getOrderService().getCareSetting(2));
    order.setEncounter(Context.getEncounterService().getEncounter(3));
    order.setOrderer(Context.getProviderService().getProvider(1));
    Drug drug = Context.getConceptService().getDrug(3);
    order.setDrug(drug);
    order.setConcept(null);
    FreeTextDosingInstructions di = new FreeTextDosingInstructions();
    di.setInstructions("testing");
    di.setDosingInstructions(order);
    Errors errors = new BindException(order, "order");
    new DrugOrderValidator().validate(order, errors);
    Assert.assertFalse(errors.hasFieldErrors());
}
Also used : DrugOrder(org.openmrs.DrugOrder) Drug(org.openmrs.Drug) FreeTextDosingInstructions(org.openmrs.FreeTextDosingInstructions) Errors(org.springframework.validation.Errors) BindException(org.springframework.validation.BindException) Test(org.junit.Test) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest)

Aggregations

Test (org.junit.Test)1 Drug (org.openmrs.Drug)1 DrugOrder (org.openmrs.DrugOrder)1 FreeTextDosingInstructions (org.openmrs.FreeTextDosingInstructions)1 OrderUtilTest (org.openmrs.order.OrderUtilTest)1 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)1 BindException (org.springframework.validation.BindException)1 Errors (org.springframework.validation.Errors)1