Search in sources :

Example 11 with ProgramWorkflowState

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

the class ProgramWorkflowServiceUnitTest method saveProgram_shouldFailIfProgramWorkFlowStateConceptIsNull.

@Test
public void saveProgram_shouldFailIfProgramWorkFlowStateConceptIsNull() {
    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.setInitial(true);
    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)

Example 12 with ProgramWorkflowState

use of org.openmrs.ProgramWorkflowState 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

ProgramWorkflowState (org.openmrs.ProgramWorkflowState)12 Test (org.junit.Test)9 ProgramWorkflow (org.openmrs.ProgramWorkflow)9 PatientProgram (org.openmrs.PatientProgram)8 Program (org.openmrs.Program)6 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)6 Concept (org.openmrs.Concept)4 PatientState (org.openmrs.PatientState)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 HashMap (java.util.HashMap)1 ConceptName (org.openmrs.ConceptName)1 Patient (org.openmrs.Patient)1 PatientIdentifier (org.openmrs.PatientIdentifier)1 PatientIdentifierType (org.openmrs.PatientIdentifierType)1 APIException (org.openmrs.api.APIException)1 PatientService (org.openmrs.api.PatientService)1 ProgramWorkflowService (org.openmrs.api.ProgramWorkflowService)1 BindException (org.springframework.validation.BindException)1