public void testFormEditSessionAttribute(FormEntrySession formEntrySession) {
}
public void run() throws Exception {
// setup the blank form for the specified patient
Patient patient = getPatient();
FormEntrySession session = setupFormEntrySession(patient, getFormName());
testFormEntrySessionAttribute(session);
String html = session.getHtmlToDisplay();
testBlankFormHtml(html);
// submit some initial data and test it
Map<String, String> labeledWidgets = getLabeledWidgets(html, widgetLabels());
MockHttpServletRequest request = new MockHttpServletRequest();
request.setSession(session.getHttpSession());
setupRequest(request, labeledWidgets);
Patient patientToView = null;
Encounter encounterToView = null;
if (request.getParameterMap().size() > 0) {
SubmissionResults results = doSubmission(session, request);
testResults(results);
patientToView = results.getPatient();
encounterToView = results.getEncounterCreated();
}
// view that patient and run tests on it
Patient overridePatient = getPatientToView();
boolean doViewPatient = overridePatient != null || doViewPatient();
if (doViewPatient) {
if (overridePatient != null)
patientToView = overridePatient;
session = setupFormViewSession(patientToView, null, getFormName());
testFormViewSessionAttribute(session);
html = session.getHtmlToDisplay();
testViewingPatient(patientToView, html);
}
// view that encounter and run tests on that
Encounter override = getEncounterToView();
boolean doViewEncounter = override != null || doViewEncounter();
if (doViewEncounter) {
if (override != null)
encounterToView = override;
session = setupFormViewSession(patientToView, encounterToView, getFormName());
testFormViewSessionAttribute(session);
html = session.getHtmlToDisplay();
testViewingEncounter(encounterToView, html);
}
// edit the encounter, and run tests on that
override = getEncounterToEdit();
boolean doEditEncounter = override != null || doEditEncounter();
overridePatient = getPatientToEdit();
boolean doEditPatient = overridePatient != null || doEditPatient();
if (doEditEncounter || doEditPatient) {
Encounter toEdit = encounterToView;
if (override != null)
toEdit = override;
Patient patientToEdit = patientToView;
if (overridePatient != null)
patientToEdit = overridePatient;
session = setupFormEditSession(patientToEdit, toEdit, getFormName());
testFormEditSessionAttribute(session);