You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2006/02/20 03:59:13 UTC

svn commit: r379001 - in /myfaces/commons/trunk/src/test/java/org/apache/myfaces: taglib/UIComponentTagUtilsTest.java test/DummyFacesContext.java

Author: dennisbyrne
Date: Sun Feb 19 18:59:11 2006
New Revision: 379001

URL: http://svn.apache.org/viewcvs?rev=379001&view=rev
Log:
refactored UIComponentTagUtilsTest and removed DummyFacesContext

Removed:
    myfaces/commons/trunk/src/test/java/org/apache/myfaces/test/DummyFacesContext.java
Modified:
    myfaces/commons/trunk/src/test/java/org/apache/myfaces/taglib/UIComponentTagUtilsTest.java

Modified: myfaces/commons/trunk/src/test/java/org/apache/myfaces/taglib/UIComponentTagUtilsTest.java
URL: http://svn.apache.org/viewcvs/myfaces/commons/trunk/src/test/java/org/apache/myfaces/taglib/UIComponentTagUtilsTest.java?rev=379001&r1=379000&r2=379001&view=diff
==============================================================================
--- myfaces/commons/trunk/src/test/java/org/apache/myfaces/taglib/UIComponentTagUtilsTest.java (original)
+++ myfaces/commons/trunk/src/test/java/org/apache/myfaces/taglib/UIComponentTagUtilsTest.java Sun Feb 19 18:59:11 2006
@@ -17,21 +17,25 @@
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.html.HtmlInputText;
-import javax.faces.context.FacesContext;
 
-import junit.framework.TestCase;
+import junit.framework.Test;
 
-import org.apache.myfaces.test.DummyFacesContext;
-import org.apache.myfaces.test.FacesContextHelper;
+import org.apache.shale.test.base.AbstractJsfTestCase;
 
 /**
  * TestCase for UIComponentTagUtils
  */
-public class UIComponentTagUtilsTest extends TestCase {
+public class UIComponentTagUtilsTest extends AbstractJsfTestCase {
 
-    FacesContext context;
+    public UIComponentTagUtilsTest(String name) {
+		super(name);
+	}
 
-    /**
+    public static Test suite() {
+        return null; // keep this method or maven won't run it
+    }
+    
+	/**
      * Simple custom component that counts how many times its
      * getValue method is called.
      */
@@ -44,19 +48,17 @@
     };
 
     public void setUp() {
-        context = new DummyFacesContext();
-        FacesContextHelper.setCurrentInstance(context);
+    	super.setUp();
     }
     
     public void tearDown() {
-        FacesContextHelper.setCurrentInstance(null);
+    	super.tearDown();
     }
     
     /**
      * Test that the setStringProperty util method works as expected.
      */
     public void testSetStringProperty() {
-        FacesContext context = new DummyFacesContext();
         UIComponent component = new HtmlInputText();
         String propName;
         String propValue;
@@ -69,7 +71,7 @@
         oldValue = (String) component.getAttributes().get(propName);
         assertNull(oldValue);
         
-        UIComponentTagUtils.setStringProperty(context, component, propName, propValue);
+        UIComponentTagUtils.setStringProperty(facesContext, component, propName, propValue);
         
         oldValue = (String) component.getAttributes().get(propName);
         assertEquals(oldValue, propValue);
@@ -81,7 +83,7 @@
         oldValue = (String) component.getAttributes().get(propName);
         assertNull(oldValue);
         
-        UIComponentTagUtils.setStringProperty(context, component, propName, propValue);
+        UIComponentTagUtils.setStringProperty(facesContext, component, propName, propValue);
         
         oldValue = (String) component.getAttributes().get(propName);
         assertEquals(oldValue, propValue);