DDMFormRendererTag extends BaseDDMFormRendererTag { protected DDMFormRenderingContext createDDMFormRenderingContext( DDMForm ddmForm) { DDMFormRenderingContext ddmFormRenderingContext = new DDMFormRenderingContext(); DDMFormInstance ddmFormInstance = getDDMFormInstance(); ddmFormRenderingContext.setContainerId( "form_" + StringUtil.randomString()); ddmFormRenderingContext.setGroupId(ddmFormInstance.getGroupId()); ddmFormRenderingContext.setHttpServletRequest(request); RenderResponse renderResponse = getRenderResponse(); ddmFormRenderingContext.setHttpServletResponse( PortalUtil.getHttpServletResponse(renderResponse)); ddmFormRenderingContext.setLocale(getLocale(request, ddmForm)); ddmFormRenderingContext.setViewMode(true); setDDMFormValues(ddmFormRenderingContext, ddmForm); setPortletNamespace(ddmFormRenderingContext, renderResponse); setReadOnly(ddmFormRenderingContext); setSubmitButton(ddmFormRenderingContext, ddmFormInstance); return ddmFormRenderingContext; }  @Override int doStartTag();  }
@Test public void testCreateDDMFormRenderingContext() { setDDMFormRendererTagInputs(1L, null, null, null, false, false); DDMForm ddmForm = new DDMForm(); ddmForm.setDefaultLocale(LocaleUtil.US); DDMFormRenderingContext ddmFormRenderingContext = _ddmFormRendererTag.createDDMFormRenderingContext(ddmForm); Assert.assertNotNull(ddmFormRenderingContext.getContainerId()); Assert.assertEquals( _ddmFormInstance.getGroupId(), ddmFormRenderingContext.getGroupId()); Assert.assertNotNull(ddmFormRenderingContext.getHttpServletRequest()); Assert.assertNotNull(ddmFormRenderingContext.getHttpServletResponse()); Assert.assertEquals(LocaleUtil.US, ddmFormRenderingContext.getLocale()); Assert.assertTrue(ddmFormRenderingContext.isViewMode()); Assert.assertNotNull(ddmFormRenderingContext.getDDMFormValues()); Assert.assertNotNull(ddmFormRenderingContext.getPortletNamespace()); Assert.assertFalse(ddmFormRenderingContext.isReadOnly()); Assert.assertFalse(ddmFormRenderingContext.isShowSubmitButton()); }