Author: sergeyhalipov
Date: 2007-09-10 13:45:04 -0400 (Mon, 10 Sep 2007)
New Revision: 2847
Added:
trunk/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java
Log:
JUnit tests for UIInclude class.
Added: trunk/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java
(rev 0)
+++
trunk/ui/core/src/test/java/org/ajax4jsf/component/IncludeComponentTest.java 2007-09-10
17:45:04 UTC (rev 2847)
@@ -0,0 +1,86 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.component;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+public class IncludeComponentTest extends org.ajax4jsf.tests.AbstractAjax4JsfTestCase {
+ UIInclude include = null;
+ UIForm form = null;
+
+ public IncludeComponentTest(String name) {
+ super(name);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ include = (UIInclude) application.createComponent(UIInclude.COMPONENT_TYPE);
+ include.setId("include");
+ include.setLayout("none");
+
+ form.getChildren().add(include);
+
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ include = null;
+ }
+
+ public void testState() throws Exception {
+
+ }
+
+ public void testViewId() throws Exception {
+ include.setViewId(null);
+ assertNull(include.getViewId());
+
+ String viewId = "viewId";
+ include.setViewId(viewId);
+ String newViewId = include.getViewId();
+ assertNotNull(newViewId);
+ assertEquals(viewId, newViewId);
+ }
+
+ public void testLayout() throws Exception {
+ include.setLayout(null);
+ assertNull(include.getLayout());
+
+ String layout = "block";
+ include.setLayout(layout);
+ String newLayout = include.getLayout();
+ assertNotNull(newLayout);
+ assertEquals(layout, newLayout);
+ }
+
+ public void testAjaxRendered() throws Exception {
+ assertFalse(include.isAjaxRendered());
+ }
+
+}
Show replies by date