[richfaces-svn-commits] JBoss Rich Faces SVN: r352 - in trunk/richfaces/tabPanel/src: test/java/org/richfaces and 2 other directories.
richfaces-svn-commits at lists.jboss.org
richfaces-svn-commits at lists.jboss.org
Wed Apr 11 08:09:18 EDT 2007
Author: A.Skokov
Date: 2007-04-11 08:09:18 -0400 (Wed, 11 Apr 2007)
New Revision: 352
Added:
trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabTest.java
trunk/richfaces/tabPanel/src/test/java/org/richfaces/model/
trunk/richfaces/tabPanel/src/test/java/org/richfaces/model/TabTest.java
Modified:
trunk/richfaces/tabPanel/src/main/java/org/richfaces/model/Tab.java
trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
Log:
test updated
Modified: trunk/richfaces/tabPanel/src/main/java/org/richfaces/model/Tab.java
===================================================================
--- trunk/richfaces/tabPanel/src/main/java/org/richfaces/model/Tab.java 2007-04-11 11:08:17 UTC (rev 351)
+++ trunk/richfaces/tabPanel/src/main/java/org/richfaces/model/Tab.java 2007-04-11 12:09:18 UTC (rev 352)
@@ -23,136 +23,130 @@
/**
* Tab model bean represent a single tab in list of tabs for panel.
+ *
* @author shura (latest modification by $Author: ishabalov $)
* @version $Revision: 1.3 $ $Date: 2007/02/21 20:35:05 $
- *
*/
public class Tab implements TabModel {
- private Object _name;
- private String _label;
- private boolean _disabled;
- private String _labelWidth;
-// private String _description;
- private String _switchType;
- private String _title;
-
-
- /**
- * No-argument constructor for JavaBean contract.
- */
- public Tab() {
- super();
- }
-
- public Tab(Object value) {
- this(value,value.toString(),false,null,null);
- }
- /**
- * @param value
- * @param label
- * @param disabled
- * @param labelWidth
- * @param title
- */
- public Tab(Object value, String label, boolean disabled, String labelWidth, String title) {
- super();
- this._name = value;
- this._label = label;
- this._disabled = disabled;
- this._labelWidth = labelWidth;
- this._title = title;
-// this._description = description;
- }
- /**
- * @return Returns the description.
- */
-/* public String getDescription() {
- return this._description;
- }*/
- /**
- * @param description The description to set.
- */
-/* public void setDescription(String description) {
- this._description = description;
- }*/
- /**
- * @return Returns the disabled.
- */
- public boolean isDisabled() {
- return this._disabled;
- }
- /**
- * @param disabled The disabled to set.
- */
- public void setDisabled(boolean disabled) {
- this._disabled = disabled;
- }
- /**
- * @return Returns the label.
- */
- public String getLabel() {
- return this._label;
- }
- /**
- * @param label The label to set.
- */
- public void setLabel(String label) {
- this._label = label;
- }
- /**
- * @return Returns the labelWidth.
- */
- public String getLabelWidth() {
- return this._labelWidth;
- }
- /**
- * @param labelWidth The labelWidth to set.
- */
- public void setLabelWidth(String labelWidth) {
- this._labelWidth = labelWidth;
- }
- /**
- * @return Returns the value.
- */
- public Object getName() {
- return this._name;
- }
- /**
- * @param value The value to set.
- */
- public void setName(Object value) {
- if(value == null) {
- throw new NullPointerException("value for tab set to null");
- }
- this._name = value;
- }
+ private Object _name;
+ private String _label;
+ private boolean _disabled;
+ private String _labelWidth;
+ private String _switchType;
+ private String _title;
- /**
- * @return Returns the switchType.
- */
- public String getSwitchType() {
- return _switchType;
- }
+ /**
+ * No-argument constructor for JavaBean contract.
+ */
+ public Tab() {
+ super();
+ }
- /**
- * @param switchType The switchType to set.
- */
- public void setSwitchType(String switchType) {
- _switchType = switchType;
- }
- /**
- * @return Returns the title.
- */
- public String getTitle() {
- return _title;
- }
- /**
- * @param title The title to set.
- */
- public void setTitle(String newvalue) {
- this._title = newvalue;
-
- }
-
+ public Tab(Object value) {
+ this(value, value.toString(), false, null, null);
+ }
+
+ /**
+ * @param value
+ * @param label
+ * @param disabled
+ * @param labelWidth
+ * @param title
+ */
+ public Tab(Object value, String label, boolean disabled, String labelWidth, String title) {
+ super();
+ this._name = value;
+ this._label = label;
+ this._disabled = disabled;
+ this._labelWidth = labelWidth;
+ this._title = title;
+ }
+
+ /**
+ * @return Returns the disabled.
+ */
+ public boolean isDisabled() {
+ return this._disabled;
+ }
+
+ /**
+ * @param disabled The disabled to set.
+ */
+ public void setDisabled(boolean disabled) {
+ this._disabled = disabled;
+ }
+
+ /**
+ * @return Returns the label.
+ */
+ public String getLabel() {
+ return this._label;
+ }
+
+ /**
+ * @param label The label to set.
+ */
+ public void setLabel(String label) {
+ this._label = label;
+ }
+
+ /**
+ * @return Returns the labelWidth.
+ */
+ public String getLabelWidth() {
+ return this._labelWidth;
+ }
+
+ /**
+ * @param labelWidth The labelWidth to set.
+ */
+ public void setLabelWidth(String labelWidth) {
+ this._labelWidth = labelWidth;
+ }
+
+ /**
+ * @return Returns the value.
+ */
+ public Object getName() {
+ return this._name;
+ }
+
+ /**
+ * @param value The value to set.
+ */
+ public void setName(Object value) {
+ if (value == null) {
+ throw new NullPointerException("value for tab set to null");
+ }
+ this._name = value;
+ }
+
+ /**
+ * @return Returns the switchType.
+ */
+ public String getSwitchType() {
+ return _switchType;
+ }
+
+ /**
+ * @param switchType The switchType to set.
+ */
+ public void setSwitchType(String switchType) {
+ _switchType = switchType;
+ }
+
+ /**
+ * @return Returns the title.
+ */
+ public String getTitle() {
+ return _title;
+ }
+
+ /**
+ * @param newvalue The title to set.
+ */
+ public void setTitle(String newvalue) {
+ this._title = newvalue;
+ }
}
Modified: trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2007-04-11 11:08:17 UTC (rev 351)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/TabPanelComponentTest.java 2007-04-11 12:09:18 UTC (rev 352)
@@ -75,16 +75,17 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
- tabPanel = (HtmlTabPanel)application.createComponent("org.richfaces.TabPanel");
+ tabPanel = (UITabPanel)application.createComponent("org.richfaces.TabPanel");
tabPanel.setId("tabPanel");
form.getChildren().add(tabPanel);
- tab1 = (HtmlTab)application.createComponent("org.richfaces.Tab");
+ tab1 = (UITab)application.createComponent("org.richfaces.Tab");
tab1.setId("tab1");
tabPanel.getChildren().add(tab1);
- tab2 = (HtmlTab)application.createComponent("org.richfaces.Tab");
+ tab2 = (UITab)application.createComponent("org.richfaces.Tab");
tab2.setId("tab2");
+ tab2.setActive(false);
tabPanel.getChildren().add(tab2);
}
Added: trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabTest.java (rev 0)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/component/UITabTest.java 2007-04-11 12:09:18 UTC (rev 352)
@@ -0,0 +1,91 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.component;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.html.HtmlTabPanel;
+import org.richfaces.component.html.HtmlTab;
+
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+
+/**
+ * Unit test for UITabTest.
+ */
+public class UITabTest extends AbstractAjax4JsfTestCase {
+
+ private UITab tab;
+ private UITabPanel tabPanel;
+ private UIForm form;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public UITabTest(String testName) {
+ super(testName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+
+ tab = (UITab)application.createComponent("org.richfaces.Tab");
+ tab.setId("tab");
+
+ tabPanel = (UITabPanel)application.createComponent("org.richfaces.TabPanel");
+
+ form = new HtmlForm();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ tab = null;
+ tabPanel = null;
+ form = null;
+ }
+
+ public void testGetPane1() throws Exception {
+ assertNull(tab.getPane());
+
+ tabPanel.getChildren().add(tab);
+ assertTrue(tab.getPane() instanceof UITabPanel);
+ }
+
+ public void testGetPane2() throws Exception {
+ assertNull(tab.getPane());
+
+ form.getChildren().add(tab);
+
+ try {
+ tab.getPane();
+ assertTrue(false);
+ } catch(Exception ex) {
+ }
+ }
+}
Added: trunk/richfaces/tabPanel/src/test/java/org/richfaces/model/TabTest.java
===================================================================
--- trunk/richfaces/tabPanel/src/test/java/org/richfaces/model/TabTest.java (rev 0)
+++ trunk/richfaces/tabPanel/src/test/java/org/richfaces/model/TabTest.java 2007-04-11 12:09:18 UTC (rev 352)
@@ -0,0 +1,115 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.richfaces.model;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * Unit test for Tab.
+ */
+public class TabTest extends AbstractAjax4JsfTestCase {
+
+ private Tab tab;
+
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public TabTest(String testName) {
+ super(testName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ tab = null;
+ }
+
+ public void testTab1() throws Exception {
+ tab = new Tab();
+
+ assertNull(tab.getName());
+ try {
+ tab.setName(null);
+ assertTrue(false);
+ } catch(Exception ex) {
+ }
+ tab.setName("name");
+ assertEquals("name", tab.getName());
+
+ tab.setLabel("label");
+ assertEquals("label", tab.getLabel());
+
+ tab.setDisabled(true);
+ assertTrue(tab.isDisabled());
+
+ tab.setLabelWidth("labelWidth");
+ assertEquals("labelWidth", tab.getLabelWidth());
+
+ tab.setSwitchType("switchType");
+ assertEquals("switchType", tab.getSwitchType());
+
+ tab.setTitle("title");
+ assertEquals("title", tab.getTitle());
+ }
+
+ public void testTab2() throws Exception {
+ tab = new Tab("name");
+ assertEquals("name", tab.getName());
+ assertEquals("name", tab.getLabel());
+ assertFalse(tab.isDisabled());
+ assertNull(tab.getLabelWidth());
+ assertNull(tab.getSwitchType());
+ assertNull(tab.getTitle());
+
+ try {
+ tab = new Tab(null);
+ assertTrue(false);
+ } catch(NullPointerException ex) {
+ }
+ }
+
+ public void testTab3() throws Exception {
+ tab = new Tab("name", "label", true, "labelWidth", "title");
+ assertEquals("name", tab.getName());
+ assertEquals("label", tab.getLabel());
+ assertTrue(tab.isDisabled());
+ assertEquals("labelWidth", tab.getLabelWidth());
+ assertEquals("title", tab.getTitle());
+ assertNull(tab.getSwitchType());
+ }
+
+ public void testTab4() throws Exception {
+ tab = new Tab();
+ assertTrue(tab instanceof TabModel);
+ }
+}
More information about the richfaces-svn-commits
mailing list