DDMFormRendererTag extends BaseDDMFormRendererTag { protected DDMFormInstance getDDMFormInstance() { long ddmFormInstanceId = 0; if (getDdmFormInstanceRecordVersionId() != null) { DDMFormInstanceRecordVersion ddmFormInstanceRecordVersion = DDMFormTaglibUtil.getDDMFormInstanceRecordVersion( getDdmFormInstanceRecordVersionId()); ddmFormInstanceId = ddmFormInstanceRecordVersion.getFormInstanceId(); } else if (getDdmFormInstanceRecordId() != null) { DDMFormInstanceRecord ddmFormInstanceRecord = DDMFormTaglibUtil.getDDMFormInstanceRecord( getDdmFormInstanceRecordId()); ddmFormInstanceId = ddmFormInstanceRecord.getFormInstanceId(); } else if (getDdmFormInstanceVersionId() != null) { DDMFormInstanceVersion ddmFormInstanceVersion = DDMFormTaglibUtil.getDDMFormInstanceVersion( getDdmFormInstanceVersionId()); ddmFormInstanceId = ddmFormInstanceVersion.getFormInstanceId(); } else if (getDdmFormInstanceId() != null) { ddmFormInstanceId = getDdmFormInstanceId(); } return DDMFormTaglibUtil.getDDMFormInstance(ddmFormInstanceId); }  @Override int doStartTag();  }
@Test public void testGetFormInstanceWhenFormInstanceRecordIdHasHigherPriority() { setDDMFormRendererTagInputs(1L, 2L, null, 4L); DDMFormInstance ddmFormInstance = _ddmFormRendererTag.getDDMFormInstance(); Assert.assertEquals(2L, ddmFormInstance.getFormInstanceId()); }
@Test public void testGetFormInstanceWhenFormInstanceRecordVersionIdHasHigherPriority() { setDDMFormRendererTagInputs(1L, 2L, 3L, 4L); DDMFormInstance ddmFormInstance = _ddmFormRendererTag.getDDMFormInstance(); Assert.assertEquals(3L, ddmFormInstance.getFormInstanceId()); }
@Test public void testGetFormInstanceWhenFormInstanceVersionIdHasHigherPriority() { setDDMFormRendererTagInputs(1L, null, null, 4L); DDMFormInstance ddmFormInstance = _ddmFormRendererTag.getDDMFormInstance(); Assert.assertEquals(4L, ddmFormInstance.getFormInstanceId()); }
@Test public void testGetFormInstanceWithFormInstanceId() { setDDMFormRendererTagInputs(1L, null, null, null); DDMFormInstance ddmFormInstance = _ddmFormRendererTag.getDDMFormInstance(); Assert.assertEquals(1L, ddmFormInstance.getFormInstanceId()); }
@Test public void testGetFormInstanceWithFormInstanceRecordId() { setDDMFormRendererTagInputs(null, 2L, null, null); DDMFormInstance ddmFormInstance = _ddmFormRendererTag.getDDMFormInstance(); Assert.assertEquals(2L, ddmFormInstance.getFormInstanceId()); }
@Test public void testGetFormInstanceWithFormInstanceRecordVersionId() { setDDMFormRendererTagInputs(null, null, 3L, null); DDMFormInstance ddmFormInstance = _ddmFormRendererTag.getDDMFormInstance(); Assert.assertEquals(3L, ddmFormInstance.getFormInstanceId()); }
@Test public void testGetFormInstanceWithFormInstanceVersionId() { setDDMFormRendererTagInputs(null, null, null, 4L); DDMFormInstance ddmFormInstance = _ddmFormRendererTag.getDDMFormInstance(); Assert.assertEquals(4L, ddmFormInstance.getFormInstanceId()); }