Search in sources :

Example 21 with ProgramWorkflow

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

the class ProgramWorkflowServiceUnitTest method saveProgram_shouldFailIfProgramWorkFlowConceptIsNull.

@Test
public void saveProgram_shouldFailIfProgramWorkFlowConceptIsNull() {
    exception.expect(APIException.class);
    exception.expectMessage("ProgramWorkflow concept is required");
    Program program = new Program();
    program.setName("TEST PROGRAM");
    program.setDescription("TEST PROGRAM DESCRIPTION");
    program.setConcept(new Concept(1));
    program.addWorkflow(new ProgramWorkflow());
    pws.saveProgram(program);
}
Also used : Concept(org.openmrs.Concept) ProgramWorkflow(org.openmrs.ProgramWorkflow) PatientProgram(org.openmrs.PatientProgram) Program(org.openmrs.Program) Test(org.junit.Test)

Example 22 with ProgramWorkflow

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

the class ProgramWorkflowServiceUnitTest method saveProgram_shouldFailIfProgramWorkFlowStateInitialIsNull.

@Test
public void saveProgram_shouldFailIfProgramWorkFlowStateInitialIsNull() {
    exception.expect(APIException.class);
    exception.expectMessage("ProgramWorkflowState concept, initial, terminal are required");
    Program program = new Program();
    program.setName("TEST PROGRAM");
    program.setDescription("TEST PROGRAM DESCRIPTION");
    program.setConcept(new Concept(1));
    ProgramWorkflow workflow = new ProgramWorkflow();
    workflow.setConcept(new Concept(2));
    ProgramWorkflowState state1 = new ProgramWorkflowState();
    state1.setConcept(new Concept(3));
    state1.setTerminal(false);
    workflow.addState(state1);
    program.addWorkflow(workflow);
    pws.saveProgram(program);
}
Also used : Concept(org.openmrs.Concept) ProgramWorkflow(org.openmrs.ProgramWorkflow) PatientProgram(org.openmrs.PatientProgram) Program(org.openmrs.Program) ProgramWorkflowState(org.openmrs.ProgramWorkflowState) Test(org.junit.Test)

Aggregations

ProgramWorkflow (org.openmrs.ProgramWorkflow)22 Test (org.junit.Test)16 PatientProgram (org.openmrs.PatientProgram)12 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)11 ProgramWorkflowState (org.openmrs.ProgramWorkflowState)9 Program (org.openmrs.Program)8 BindException (org.springframework.validation.BindException)6 Concept (org.openmrs.Concept)5 PatientState (org.openmrs.PatientState)5 ConceptStateConversion (org.openmrs.ConceptStateConversion)4 ProgramWorkflowService (org.openmrs.api.ProgramWorkflowService)4 Errors (org.springframework.validation.Errors)4 Date (java.util.Date)3 Patient (org.openmrs.Patient)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 ConceptName (org.openmrs.ConceptName)1 PatientIdentifier (org.openmrs.PatientIdentifier)1