use of org.openmrs.CareSetting in project openmrs-core by openmrs.
the class OrderServiceTest method getCareSettings_shouldReturnRetiredCareSettingsIfIncludeRetiredIsSetToTrue.
/**
* @see OrderService#getCareSettings(boolean)
*/
@Test
public void getCareSettings_shouldReturnRetiredCareSettingsIfIncludeRetiredIsSetToTrue() {
CareSetting retiredCareSetting = orderService.getCareSetting(3);
assertTrue(retiredCareSetting.getRetired());
List<CareSetting> careSettings = orderService.getCareSettings(true);
assertEquals(3, careSettings.size());
assertTrue(containsId(careSettings, retiredCareSetting.getCareSettingId()));
}
use of org.openmrs.CareSetting in project openmrs-core by openmrs.
the class OrderServiceTest method saveOrder_shouldDefaultToCareSettingAndOrderTypeDefinedInTheOrderContextIfNull.
/**
* @see OrderService#saveOrder(org.openmrs.Order, OrderContext)
*/
@Test
public void saveOrder_shouldDefaultToCareSettingAndOrderTypeDefinedInTheOrderContextIfNull() {
Order order = new TestOrder();
order.setPatient(patientService.getPatient(7));
Concept trimune30 = conceptService.getConcept(792);
order.setConcept(trimune30);
order.setOrderer(providerService.getProvider(1));
order.setEncounter(encounterService.getEncounter(3));
order.setDateActivated(new Date());
OrderType expectedOrderType = orderService.getOrderType(2);
CareSetting expectedCareSetting = orderService.getCareSetting(1);
OrderContext orderContext = new OrderContext();
orderContext.setOrderType(expectedOrderType);
orderContext.setCareSetting(expectedCareSetting);
order = orderService.saveOrder(order, orderContext);
assertFalse(expectedOrderType.getConceptClasses().contains(trimune30.getConceptClass()));
assertEquals(expectedOrderType, order.getOrderType());
assertEquals(expectedCareSetting, order.getCareSetting());
}
use of org.openmrs.CareSetting in project openmrs-core by openmrs.
the class OrderServiceTest method getOrders_shouldGetTheOrdersThatMatchAllTheArguments.
/**
* @see OrderService#getOrders(org.openmrs.Patient, org.openmrs.CareSetting,
* org.openmrs.OrderType, boolean)
*/
@Test
public void getOrders_shouldGetTheOrdersThatMatchAllTheArguments() {
Patient patient = patientService.getPatient(2);
CareSetting outPatient = orderService.getCareSetting(1);
OrderType testOrderType = orderService.getOrderType(2);
List<Order> testOrders = orderService.getOrders(patient, outPatient, testOrderType, false);
assertEquals(3, testOrders.size());
TestUtil.containsId(testOrders, 6);
TestUtil.containsId(testOrders, 7);
TestUtil.containsId(testOrders, 9);
OrderType drugOrderType = orderService.getOrderType(1);
List<Order> drugOrders = orderService.getOrders(patient, outPatient, drugOrderType, false);
assertEquals(5, drugOrders.size());
TestUtil.containsId(drugOrders, 2);
TestUtil.containsId(drugOrders, 3);
TestUtil.containsId(drugOrders, 44);
TestUtil.containsId(drugOrders, 444);
TestUtil.containsId(drugOrders, 5);
CareSetting inPatient = orderService.getCareSetting(2);
List<Order> inPatientDrugOrders = orderService.getOrders(patient, inPatient, drugOrderType, false);
assertEquals(222, inPatientDrugOrders.get(0).getOrderId().intValue());
}
Aggregations