Author: julien(a)jboss.com
Date: 2007-02-26 11:12:24 -0500 (Mon, 26 Feb 2007)
New Revision: 6404
Added:
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
Modified:
trunk/faces/build.xml
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
Log:
- adding AbstractDynamicBean test case
- make AbstractBeanDecoratorTestCase state follow junit lifecycle
Modified: trunk/faces/build.xml
===================================================================
--- trunk/faces/build.xml 2007-02-26 16:01:10 UTC (rev 6403)
+++ trunk/faces/build.xml 2007-02-26 16:12:24 UTC (rev 6404)
@@ -225,6 +225,7 @@
</x-sysproperty>
<x-test>
<test todir="${test.reports}"
name="org.jboss.portal.test.faces.el.AbstractBeanDecoratorTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.faces.el.AbstractDynamicBeanTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Modified:
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
===================================================================
---
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-02-26
16:01:10 UTC (rev 6403)
+++
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-02-26
16:12:24 UTC (rev 6404)
@@ -35,10 +35,26 @@
public class AbstractBeanDecoratorTestCase extends TestCase
{
- private final Object _bean = new Object();
- private final Object _propertyName = new Object();
- private Object _propertyValue = new Value();
+ private Object _bean;
+ private Object _propertyName;
+ private Object _propertyValue;
+
+ protected void setUp() throws Exception
+ {
+ _bean = new Object();
+ _propertyName = new Object();
+ _propertyValue = new Value();
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ _bean = null;
+ _propertyName = null;
+ _propertyValue = null;
+ }
+
private static class Value
{
}
Added:
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java 2007-02-26
16:12:24 UTC (rev 6404)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.dynamic.AbstractDynamicBean;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDynamicBeanTestCase extends TestCase
+{
+
+ /** . */
+ private final AbstractDynamicBean bean = new AbstractDynamicBean();
+
+ /** . */
+ private final Object propertyName = new Object();
+
+ public void testGetType()
+ {
+ try
+ {
+ bean.getType(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(null, bean.getType(propertyName));
+ }
+
+ public void testGetValue()
+ {
+ try
+ {
+ bean.getValue(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(null, bean.getValue(propertyName));
+ }
+
+ public void testSetValue()
+ {
+ try
+ {
+ bean.setValue(null, new Object());
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertFalse(bean.setValue(propertyName, new Object()));
+ assertFalse(bean.setValue(propertyName, null));
+ }
+
+}