Search in sources :

Example 46 with OrderType

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

the class OrderServiceTest method getOrders_shouldGetAllUnvoidedMatchesIfIncludeVoidedIsSetToFalse.

/**
 * @see OrderService#getOrders(org.openmrs.Patient, org.openmrs.CareSetting,
 *      org.openmrs.OrderType, boolean)
 */
@Test
public void getOrders_shouldGetAllUnvoidedMatchesIfIncludeVoidedIsSetToFalse() {
    Patient patient = patientService.getPatient(2);
    CareSetting outPatient = orderService.getCareSetting(1);
    OrderType testOrderType = orderService.getOrderType(2);
    assertEquals(3, orderService.getOrders(patient, outPatient, testOrderType, false).size());
}
Also used : OrderType(org.openmrs.OrderType) Patient(org.openmrs.Patient) CareSetting(org.openmrs.CareSetting) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest) Test(org.junit.Test)

Example 47 with OrderType

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

the class OrderServiceTest method purgeOrderType_shouldNotAllowDeletingAnOrderTypeThatIsInUse.

/**
 * @see OrderService#purgeOrderType(org.openmrs.OrderType)
 */
@Test
public void purgeOrderType_shouldNotAllowDeletingAnOrderTypeThatIsInUse() {
    OrderType orderType = orderService.getOrderType(1);
    assertNotNull(orderType);
    expectedException.expect(CannotDeleteObjectInUseException.class);
    expectedException.expectMessage(mss.getMessage("Order.type.cannot.delete"));
    orderService.purgeOrderType(orderType);
}
Also used : OrderType(org.openmrs.OrderType) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest) Test(org.junit.Test)

Example 48 with OrderType

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

the class OrderServiceTest method purgeOrderType_shouldDeleteOrderTypeIfNotInUse.

/**
 * @see OrderService#purgeOrderType(org.openmrs.OrderType)
 */
@Test
public void purgeOrderType_shouldDeleteOrderTypeIfNotInUse() {
    final Integer id = 13;
    OrderType orderType = orderService.getOrderType(id);
    assertNotNull(orderType);
    orderService.purgeOrderType(orderType);
    assertNull(orderService.getOrderType(id));
}
Also used : OrderType(org.openmrs.OrderType) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest) Test(org.junit.Test)

Example 49 with OrderType

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

the class OrderServiceTest method retireOrderType_shouldNotRetireIndependentField.

/**
 * @see OrderService#retireOrderType(org.openmrs.OrderType, String)
 */
@Test
public void retireOrderType_shouldNotRetireIndependentField() {
    OrderType orderType = orderService.getOrderType(2);
    ConceptClass conceptClass = conceptService.getConceptClass(1);
    Assert.assertFalse(conceptClass.getRetired());
    orderType.addConceptClass(conceptClass);
    orderService.retireOrderType(orderType, "test retire reason");
    Assert.assertFalse(conceptClass.getRetired());
}
Also used : ConceptClass(org.openmrs.ConceptClass) OrderType(org.openmrs.OrderType) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest) Test(org.junit.Test)

Example 50 with OrderType

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

the class OrderServiceTest method getOrderTypeByConcept_shouldGetOrderTypeMappedToTheGivenConcept.

/**
 * @see OrderService#getOrderTypeByConcept(Concept)
 */
@Test
public void getOrderTypeByConcept_shouldGetOrderTypeMappedToTheGivenConcept() {
    OrderType orderType = orderService.getOrderTypeByConcept(Context.getConceptService().getConcept(5089));
    Assert.assertNotNull(orderType);
    Assert.assertEquals(2, orderType.getOrderTypeId().intValue());
}
Also used : OrderType(org.openmrs.OrderType) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest) Test(org.junit.Test)

Aggregations

OrderType (org.openmrs.OrderType)54 Test (org.junit.Test)46 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)45 OrderUtilTest (org.openmrs.order.OrderUtilTest)29 BindException (org.springframework.validation.BindException)22 Errors (org.springframework.validation.Errors)22 Patient (org.openmrs.Patient)17 DrugOrder (org.openmrs.DrugOrder)16 CareSetting (org.openmrs.CareSetting)15 Encounter (org.openmrs.Encounter)11 GlobalProperty (org.openmrs.GlobalProperty)8 Order (org.openmrs.Order)8 TestOrder (org.openmrs.TestOrder)6 Matchers.containsInAnyOrder (org.hamcrest.Matchers.containsInAnyOrder)5 ConceptClass (org.openmrs.ConceptClass)5 HashSet (java.util.HashSet)4 Date (java.util.Date)3 ArrayList (java.util.ArrayList)2 Criteria (org.hibernate.Criteria)2 PatientServiceImplTest (org.openmrs.api.impl.PatientServiceImplTest)2