@Test public void shouldDisplayAllStatesIfInInitialState() throws Exception { transitionToState(START_STATE); String htmlform = "<htmlform><workflowState workflowId=\"100\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, START_STATE); assertPresent(session, MIDDLE_STATE); assertPresent(session, END_STATE); }
@Test public void shouldDisplayStateLabels() throws Exception { transitionToState(START_STATE); String startState = "Transition to start state"; String endState = "Transition to end state"; String htmlform = "<htmlform><workflowState workflowId=\"100\" stateIds=\"" + START_STATE + "," + END_STATE + "\" stateLabels=\"" + startState + ", " + endState + "\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, startState); assertPresent(session, endState); }
@Test public void shouldDisplayOnlySpecifiedStatesGivenIds() throws Exception { transitionToState(START_STATE); String htmlform = "<htmlform><workflowState workflowId=\"100\" stateIds=\"200,201\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, START_STATE); assertPresent(session, END_STATE); assertNotPresent(session, MIDDLE_STATE); }
@Test public void shouldDisplayOnlySpecifiedStates() throws Exception { transitionToState(START_STATE); String htmlform = "<htmlform><workflowState workflowId=\"100\" stateIds=\"" + START_STATE + "," + END_STATE + "\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, START_STATE); assertPresent(session, END_STATE); assertNotPresent(session, MIDDLE_STATE); }
@Test public void shouldDisplayStateLabel() throws Exception { String startState = "Transition to start state"; String htmlform = "<htmlform><workflowState workflowId=\"100\" stateId=\"" + START_STATE + "\" stateLabel=\"" + startState + "\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, startState); }
@Test public void shouldDisplayLabel() throws Exception { String label = "Some label text"; String htmlform = "<htmlform><workflowState workflowId=\"100\" labelText=\"" + label + "\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, label); }
@Test public void shouldDisplayIfSpecifiedStateAndHiddenStyle() throws Exception { String htmlform = "<htmlform><workflowState workflowId=\"100\" stateId=\"" + START_STATE + "\" type=\"hidden\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, START_STATE); Assert.assertTrue("Checkbox result: " + session.getHtmlToDisplay(), session.getHtmlToDisplay().contains("hidden")); }
@Test public void shouldDisplayIfSpecifiedStateAndCheckboxStyle() throws Exception { String htmlform = "<htmlform><workflowState workflowId=\"100\" stateId=\"" + START_STATE + "\" type=\"checkbox\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, START_STATE); Assert.assertTrue("Checkbox result: " + session.getHtmlToDisplay(), session.getHtmlToDisplay().contains("checkbox")); }
@Test public void shouldDisplayOnlyInitialStateIfNotEnrolled() throws Exception { String htmlform = "<htmlform><workflowState workflowId=\"100\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, START_STATE); assertNotPresent(session, MIDDLE_STATE); assertNotPresent(session, END_STATE); }
@Test public void shouldDisplayOnlySpecifiedStateAndDefaultToCheckbox() throws Exception { String htmlform = "<htmlform><workflowState workflowId=\"100\" stateId=\"" + START_STATE + "\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, START_STATE); assertNotPresent(session, MIDDLE_STATE); assertNotPresent(session, END_STATE); Assert.assertTrue("Checkbox result: " + session.getHtmlToDisplay(), session.getHtmlToDisplay().contains("checkbox")); }
@Test public void shouldDisplayStateSpecifiedByMapping() throws Exception { executeDataSet(XML_DATASET_PATH + new TestUtil().getTestDatasetFilename(XML_TEST_DATASET)); String htmlform = "<htmlform><workflowState workflowId=\"108\" stateId=\"SNOMED CT:Test Code\"/></htmlform>"; FormEntrySession session = new FormEntrySession(patient, htmlform, null); assertPresent(session, MAPPED_STATE); }