use of org.openmrs.TestOrder 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());
}
Aggregations