Search in sources :

Example 1 with OrderContext

use of org.openmrs.api.OrderContext in project openmrs-module-mirebalais by PIH.

the class RadiologyOrderNumberGeneratorTest method shouldReturnStandardOrderNumberForNonRadiologyOrder.

@Test
public void shouldReturnStandardOrderNumberForNonRadiologyOrder() {
    OrderContext context = new OrderContext();
    context.setOrderType(otherOrderType);
    assertThat(generator.getNewOrderNumber(context), is("ORD-15"));
}
Also used : OrderContext(org.openmrs.api.OrderContext) Test(org.junit.Test)

Example 2 with OrderContext

use of org.openmrs.api.OrderContext in project openmrs-module-mirebalais by PIH.

the class RadiologyOrderNumberGeneratorComponentTest method shouldGenerateStandardOrderNumber.

@Test
public void shouldGenerateStandardOrderNumber() {
    // new test order
    Order order = new TestOrder();
    order.setEncounter(encounterService.getEncounter(6));
    order.setPatient(patientService.getPatient(7));
    order.setConcept(conceptService.getConcept(5497));
    order.setOrderer(providerService.getProvider(1));
    order.setCareSetting(orderService.getCareSetting(1));
    order.setOrderType(orderService.getOrderType(2));
    order.setEncounter(encounterService.getEncounter(3));
    order.setDateActivated(new Date());
    OrderContext orderContext = new OrderContext();
    order = orderService.saveOrder(order, orderContext);
    // the GP "order.nextOrderNumberSeed" is set to 1 in the standard test dataset
    assertThat(order.getOrderNumber(), is("ORD-1"));
}
Also used : RadiologyOrder(org.openmrs.module.radiologyapp.RadiologyOrder) TestOrder(org.openmrs.TestOrder) Order(org.openmrs.Order) TestOrder(org.openmrs.TestOrder) Date(java.util.Date) OrderContext(org.openmrs.api.OrderContext) BaseModuleContextSensitiveTest(org.openmrs.test.BaseModuleContextSensitiveTest) Test(org.junit.Test)

Example 3 with OrderContext

use of org.openmrs.api.OrderContext in project openmrs-module-mirebalais by PIH.

the class RadiologyOrderNumberGeneratorComponentTest method shouldGenerateRadiologyOrderNumber.

@Test
public void shouldGenerateRadiologyOrderNumber() {
    // new test order
    Order order = new RadiologyOrder();
    order.setEncounter(encounterService.getEncounter(6));
    order.setPatient(patientService.getPatient(7));
    order.setConcept(conceptService.getConcept(5497));
    order.setOrderer(providerService.getProvider(1));
    order.setCareSetting(orderService.getCareSetting(1));
    order.setOrderType(orderService.getOrderType(1001));
    order.setEncounter(encounterService.getEncounter(3));
    order.setDateActivated(new Date());
    OrderContext orderContext = new OrderContext();
    orderContext.setOrderType(orderService.getOrderType(1001));
    order = orderService.saveOrder(order, orderContext);
    assertThat(order.getOrderNumber(), is("0000000125"));
}
Also used : RadiologyOrder(org.openmrs.module.radiologyapp.RadiologyOrder) TestOrder(org.openmrs.TestOrder) Order(org.openmrs.Order) RadiologyOrder(org.openmrs.module.radiologyapp.RadiologyOrder) Date(java.util.Date) OrderContext(org.openmrs.api.OrderContext) BaseModuleContextSensitiveTest(org.openmrs.test.BaseModuleContextSensitiveTest) Test(org.junit.Test)

Example 4 with OrderContext

use of org.openmrs.api.OrderContext in project openmrs-module-mirebalais by PIH.

the class RadiologyOrderNumberGeneratorTest method shouldReturnRadiologyOrderNumberForRadiologyOrder.

@Test
public void shouldReturnRadiologyOrderNumberForRadiologyOrder() {
    OrderContext context = new OrderContext();
    context.setOrderType(radiologyOrderType);
    assertThat(generator.getNewOrderNumber(context), is("0000000109"));
}
Also used : OrderContext(org.openmrs.api.OrderContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 OrderContext (org.openmrs.api.OrderContext)4 Date (java.util.Date)2 Order (org.openmrs.Order)2 TestOrder (org.openmrs.TestOrder)2 RadiologyOrder (org.openmrs.module.radiologyapp.RadiologyOrder)2 BaseModuleContextSensitiveTest (org.openmrs.test.BaseModuleContextSensitiveTest)2