Search in sources :

Example 1 with CareSetting

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

the class OrderServiceTest method getCareSettingByName_shouldReturnTheCareSettingWithTheSpecifiedName.

/**
 * @see OrderService#getCareSettingByName(String)
 */
@Test
public void getCareSettingByName_shouldReturnTheCareSettingWithTheSpecifiedName() {
    CareSetting cs = orderService.getCareSettingByName("INPATIENT");
    assertEquals(2, cs.getId().intValue());
    // should also be case insensitive
    cs = orderService.getCareSettingByName("inpatient");
    assertEquals(2, cs.getId().intValue());
}
Also used : CareSetting(org.openmrs.CareSetting) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest) Test(org.junit.Test)

Example 2 with CareSetting

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

the class OrderServiceTest method getOrders_shouldIncludeVoidedMatchesIfIncludeVoidedIsSetToTrue.

/**
 * @see OrderService#getOrders(org.openmrs.Patient, org.openmrs.CareSetting,
 *      org.openmrs.OrderType, boolean)
 */
@Test
public void getOrders_shouldIncludeVoidedMatchesIfIncludeVoidedIsSetToTrue() {
    Patient patient = patientService.getPatient(2);
    CareSetting outPatient = orderService.getCareSetting(1);
    OrderType testOrderType = orderService.getOrderType(2);
    assertEquals(4, orderService.getOrders(patient, outPatient, testOrderType, true).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 3 with CareSetting

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

the class OrderServiceTest method getCareSettingByUuid_shouldReturnTheCareSettingWithTheSpecifiedUuid.

/**
 * @see OrderService#getCareSettingByUuid(String)
 */
@Test
public void getCareSettingByUuid_shouldReturnTheCareSettingWithTheSpecifiedUuid() {
    CareSetting cs = orderService.getCareSettingByUuid("6f0c9a92-6f24-11e3-af88-005056821db0");
    assertEquals(1, cs.getId().intValue());
}
Also used : CareSetting(org.openmrs.CareSetting) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest) Test(org.junit.Test)

Example 4 with CareSetting

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

the class OrderServiceTest method getOrders_shouldIncludeOrdersForSubTypesIfOrderTypeIsSpecified.

/**
 * @see OrderService#getOrders(org.openmrs.Patient, org.openmrs.CareSetting,
 *      org.openmrs.OrderType, boolean)
 */
@Test
public void getOrders_shouldIncludeOrdersForSubTypesIfOrderTypeIsSpecified() {
    executeDataSet("org/openmrs/api/include/OrderServiceTest-otherOrders.xml");
    Patient patient = patientService.getPatient(2);
    OrderType testOrderType = orderService.getOrderType(2);
    CareSetting outPatient = orderService.getCareSetting(1);
    List<Order> orders = orderService.getOrders(patient, outPatient, testOrderType, false);
    assertEquals(7, orders.size());
    Order[] expectedOrder1 = { orderService.getOrder(6), orderService.getOrder(7), orderService.getOrder(9), orderService.getOrder(101), orderService.getOrder(102), orderService.getOrder(103), orderService.getOrder(104) };
    assertThat(orders, hasItems(expectedOrder1));
    OrderType labTestOrderType = orderService.getOrderType(7);
    orders = orderService.getOrders(patient, outPatient, labTestOrderType, false);
    assertEquals(3, orderService.getOrders(patient, outPatient, labTestOrderType, false).size());
    Order[] expectedOrder2 = { orderService.getOrder(101), orderService.getOrder(103), orderService.getOrder(104) };
    assertThat(orders, hasItems(expectedOrder2));
}
Also used : DrugOrder(org.openmrs.DrugOrder) TestOrder(org.openmrs.TestOrder) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Order(org.openmrs.Order) 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 5 with CareSetting

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

the class OrderServiceTest method getActiveOrders_shouldReturnAllActiveOrdersForTheSpecifiedPatientAndCareSetting.

/**
 * @see OrderService#getActiveOrders(org.openmrs.Patient, org.openmrs.OrderType,
 *      org.openmrs.CareSetting, java.util.Date)
 */
@Test
public void getActiveOrders_shouldReturnAllActiveOrdersForTheSpecifiedPatientAndCareSetting() {
    Patient patient = patientService.getPatient(2);
    CareSetting careSetting = orderService.getCareSetting(1);
    List<Order> orders = orderService.getActiveOrders(patient, null, careSetting, null);
    assertEquals(4, orders.size());
    Order[] expectedOrders = { orderService.getOrder(3), orderService.getOrder(444), orderService.getOrder(5), orderService.getOrder(7) };
    assertThat(orders, hasItems(expectedOrders));
}
Also used : DrugOrder(org.openmrs.DrugOrder) TestOrder(org.openmrs.TestOrder) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Order(org.openmrs.Order) Patient(org.openmrs.Patient) CareSetting(org.openmrs.CareSetting) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) OrderUtilTest(org.openmrs.order.OrderUtilTest) Test(org.junit.Test)

Aggregations

CareSetting (org.openmrs.CareSetting)28 Test (org.junit.Test)27 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)27 OrderUtilTest (org.openmrs.order.OrderUtilTest)25 Patient (org.openmrs.Patient)22 DrugOrder (org.openmrs.DrugOrder)21 Encounter (org.openmrs.Encounter)16 OrderType (org.openmrs.OrderType)15 BindException (org.springframework.validation.BindException)14 Errors (org.springframework.validation.Errors)14 TestOrder (org.openmrs.TestOrder)13 Order (org.openmrs.Order)11 Matchers.containsInAnyOrder (org.hamcrest.Matchers.containsInAnyOrder)7 GlobalProperty (org.openmrs.GlobalProperty)7 Date (java.util.Date)6 Concept (org.openmrs.Concept)5 Calendar (java.util.Calendar)4 ConceptService (org.openmrs.api.ConceptService)3 OrderService (org.openmrs.api.OrderService)2 Provider (org.openmrs.Provider)1