/** * Return the form display HTML associated with the session. This has the important side-effect of having tags * populate the submissionActions list, so you must ensure this is called before you attempt to validate or process * a form's submission. * The first time you call this method on an instance will generate the HTML and cache it, so that subsequent calls * are fast (and so that the submissionActions list is only populated once). */ public String getHtmlToDisplay() throws Exception { if (htmlToDisplay == null) { htmlToDisplay = createForm(xmlDefinition); } return htmlToDisplay; }
/** * calls session.createForm on a form that has both conceptIds with labels, and conceptIds without labels in obs tags. * Verifies that the dropdown options for selecting a concept are correctly labeled. * @throws Exception */ @Test @Verifies(value = "should test labels generation for concept selects on dropdown options", method = "") public void getSectionNodes_shouldReturnDropdownForConceptSelects() throws Exception { Form form = new Form(); HtmlForm htmlform = new HtmlForm(); htmlform.setForm(form); form.setEncounterType(new EncounterType()); htmlform.setDateChanged(new Date()); htmlform.setXmlData(new TestUtil().loadXmlFromFile(XML_DATASET_PATH + "obsGroupDataExportTest.xml")); FormEntrySession session = new FormEntrySession(HtmlFormEntryUtil.getFakePerson(), htmlform, null); String xml = session.createForm(htmlform.getXmlData()); // System.out.println(xml); Assert.assertTrue(xml.contains("<option value=\"\" selected=\"true\"></option><option value=\"2474\">Susc</option><option value=\"3017\">Interm</option>")); Assert.assertTrue(xml.contains("<option value=\"\" selected=\"true\"></option><option value=\"2474\">Susceptible</option><option value=\"3017\">Intermediate</option><option value=\"1441\">Resistant</option>")); }