You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/11/19 05:26:11 UTC

svn commit: r1543306 - in /myfaces/core/trunk/api: ./ src/test/java/javax/faces/component/ src/test/java/javax/faces/component/html/ src/test/java/javax/faces/validator/

Author: lu4242
Date: Tue Nov 19 04:26:10 2013
New Revision: 1543306

URL: http://svn.apache.org/r1543306
Log:
use junit instead testng in myfaces-api

Modified:
    myfaces/core/trunk/api/pom.xml
    myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentBaseTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentPropertyTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseFacesListenerTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseValueBindingTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTestBase.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentValueExpressionTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/UIGraphicTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/component/html/HtmlOutputLinkTest.java
    myfaces/core/trunk/api/src/test/java/javax/faces/validator/_MessageUtilsTest.java

Modified: myfaces/core/trunk/api/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/pom.xml?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/pom.xml (original)
+++ myfaces/core/trunk/api/pom.xml Tue Nov 19 04:26:10 2013
@@ -412,7 +412,7 @@
                 </executions>
             </plugin>
 
-            <!-- execute tests (JUnit and TestNG) -->
+            <!-- execute tests (JUnit) -->
             <plugin>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <executions>
@@ -428,33 +428,6 @@
                             <threadCount>4</threadCount>
                             <perCoreThreadCount>true</perCoreThreadCount>
                             <testNGArtifactName>none:none</testNGArtifactName>
-                            <!-- Exclude all TestNG tests -->
-                            <excludes>
-                                <exclude>**/UIViewRootTest*</exclude>
-                                <exclude>**/_MessageUtilsTest*</exclude>
-                                <exclude>**/UIGraphicTest*</exclude>
-                                <exclude>**/UIComponentValueExpressionTest*</exclude>
-                                <exclude>**/UIComponentTest*</exclude>
-                                <exclude>**/UIComponentInvokeOnComponentTest*</exclude>
-                                <exclude>**/UIComponentEncodeAllTest*</exclude>
-                                <exclude>**/UIComponentBaseValueBindingTest*</exclude>
-                                <exclude>**/UIComponentBaseTest*</exclude>
-                                <exclude>**/UIComponentBaseProcessSaveRestoreStateTest*</exclude>
-                                <exclude>**/UIComponentBaseFacesListenerTest*</exclude>
-                                <exclude>**/HtmlOutputLinkTest*</exclude>
-                            </excludes>
-                        </configuration>
-                    </execution>
-
-                    <!-- TestNG -->
-                    <execution>
-                        <id>test-testng</id>
-                        <phase>test</phase>
-                        <goals>
-                            <goal>test</goal>
-                        </goals>
-                        <configuration>
-                            <junitArtifactName>none:none</junitArtifactName>
                         </configuration>
                     </execution>
                 </executions>
@@ -671,12 +644,6 @@
         </dependency>
         
         <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <!--<classifier>jdk15</classifier>-->
-        </dependency>
-        
-        <dependency>
             <groupId>org.apache.myfaces.test</groupId>
             <artifactId>myfaces-test22</artifactId>
         </dependency>

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentBaseTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentBaseTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentBaseTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentBaseTest.java Tue Nov 19 04:26:10 2013
@@ -27,7 +27,8 @@ import javax.faces.render.Renderer;
 
 import org.easymock.classextension.IMocksControl;
 import org.easymock.classextension.EasyMock;
-import org.testng.annotations.BeforeMethod;
+import org.junit.After;
+import org.junit.Before;
 
 /**
  * Created by IntelliJ IDEA.
@@ -43,14 +44,23 @@ public abstract class AbstractUIComponen
     protected FacesContext _facesContext;
     protected Renderer _renderer;
 
-    @BeforeMethod(alwaysRun = true)
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
         _mocksControl = EasyMock.createControl();
         _facesContext = _mocksControl.createMock(FacesContext.class);
         _testImpl = _mocksControl.createMock(UIComponentBase.class, getMockedMethodsArray());
         _renderer = _mocksControl.createMock(Renderer.class);
     }
+    
+    @After
+    public void tearDown() throws Exception
+    {
+        _mocksControl = null;
+        _facesContext = null;
+        _testImpl = null;
+        _renderer = null;
+    }
 
     protected final Method[] getMockedMethodsArray() throws Exception
     {

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentPropertyTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentPropertyTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentPropertyTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentPropertyTest.java Tue Nov 19 04:26:10 2013
@@ -20,7 +20,6 @@ package javax.faces.component;
 
 import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
-import static org.testng.Assert.assertEquals;
 
 import javax.el.ELContext;
 import javax.el.ValueExpression;
@@ -29,8 +28,10 @@ import org.apache.commons.beanutils.Prop
 import org.apache.myfaces.test.mock.MockFacesContext12;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 public abstract class AbstractUIComponentPropertyTest<T>
 {
@@ -52,8 +53,8 @@ public abstract class AbstractUIComponen
         _testValues = testValues;
     }
 
-    @BeforeMethod
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
         _mocksControl = EasyMock.createControl();
         _facesContext = new MockFacesContext12();
@@ -64,6 +65,16 @@ public abstract class AbstractUIComponen
         _component = createComponent();
     }
     
+    @After
+    public void tearDown() throws Exception
+    {
+        _mocksControl = null;
+        _facesContext = null;
+        _elContext = null;
+        _valueExpression = null;
+        _component = null;
+    }
+    
     protected IMocksControl getMocksControl()
     {
         return _mocksControl;
@@ -74,7 +85,7 @@ public abstract class AbstractUIComponen
     @Test
     public void testDefaultValue() throws Exception
     {
-        assertEquals(_defaultValue, PropertyUtils.getProperty(_component, _property));
+        Assert.assertEquals(_defaultValue, PropertyUtils.getProperty(_component, _property));
     }
 
     @Test
@@ -83,7 +94,7 @@ public abstract class AbstractUIComponen
         for (T testValue : _testValues)
         {
             PropertyUtils.setProperty(_component, _property, testValue);
-            assertEquals(testValue, PropertyUtils.getProperty(_component, _property));
+            Assert.assertEquals(testValue, PropertyUtils.getProperty(_component, _property));
         }
     }
 
@@ -96,7 +107,7 @@ public abstract class AbstractUIComponen
             expect(_valueExpression.getValue(eq(_facesContext.getELContext()))).andReturn(testValue);
             _mocksControl.replay();
             _component.setValueExpression(_property, _valueExpression);
-            assertEquals(testValue, PropertyUtils.getProperty(_component, _property));
+            Assert.assertEquals(testValue, PropertyUtils.getProperty(_component, _property));
             _mocksControl.reset();
         }
     }
@@ -112,7 +123,7 @@ public abstract class AbstractUIComponen
             _mocksControl.reset();
             expect(_valueExpression.getValue(eq(_facesContext.getELContext()))).andReturn(testValue);
             _mocksControl.replay();
-            assertEquals(testValue, PropertyUtils.getProperty(_component, _property));
+            Assert.assertEquals(testValue, PropertyUtils.getProperty(_component, _property));
             _mocksControl.reset();
         }
     }

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseFacesListenerTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseFacesListenerTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseFacesListenerTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseFacesListenerTest.java Tue Nov 19 04:26:10 2013
@@ -25,11 +25,8 @@ import java.util.Date;
 import javax.faces.event.ActionListener;
 import javax.faces.event.FacesListener;
 import javax.faces.event.ValueChangeListener;
-
-import static org.testng.Assert.*;
-
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Created by IntelliJ IDEA.
@@ -43,22 +40,33 @@ public class UIComponentBaseFacesListene
     private ActionListener _actionListener;
     private ValueChangeListener _valueChangeListener;
 
+    public UIComponentBaseFacesListenerTest()
+    {
+    }
+    
     @Override
-    @BeforeMethod
-    protected void setUp() throws Exception
+    public void setUp() throws Exception
     {
         super.setUp();
         _actionListener = _mocksControl.createMock(ActionListener.class);
         _valueChangeListener = _mocksControl.createMock(ValueChangeListener.class);
     }
+    
+    @Override
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+        _actionListener = null;
+        _valueChangeListener = null;
+    }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test(expected = NullPointerException.class)
     public void testArgNPE() throws Exception
     {
         _testImpl.getFacesListeners(null);
     }
 
-    @Test(expectedExceptions = {IllegalArgumentException.class})
+    @Test(expected = IllegalArgumentException.class)
     public void testInvalidListenerType() throws Exception
     {
         _testImpl.getFacesListeners(Date.class);
@@ -68,8 +76,8 @@ public class UIComponentBaseFacesListene
     public void testEmptyListener() throws Exception
     {
         FacesListener[] listener = _testImpl.getFacesListeners(ActionListener.class);
-        assertNotNull(listener);
-        assertEquals(0, listener.length);
+        Assert.assertNotNull(listener);
+        Assert.assertEquals(0, listener.length);
     }
 
     @Test
@@ -78,21 +86,21 @@ public class UIComponentBaseFacesListene
         _testImpl.addFacesListener(_actionListener);
 
         FacesListener[] listener = _testImpl.getFacesListeners(ValueChangeListener.class);
-        assertNotNull(listener);
-        assertEquals(0, listener.length);
-        assertTrue(ValueChangeListener.class.equals(listener.getClass().getComponentType()));
+        Assert.assertNotNull(listener);
+        Assert.assertEquals(0, listener.length);
+        Assert.assertTrue(ValueChangeListener.class.equals(listener.getClass().getComponentType()));
 
         _testImpl.addFacesListener(_valueChangeListener);
 
         listener = _testImpl.getFacesListeners(FacesListener.class);
-        assertNotNull(listener);
-        assertEquals(2, listener.length);
+        Assert.assertNotNull(listener);
+        Assert.assertEquals(2, listener.length);
         Collection<FacesListener> col = Arrays.asList(listener);
-        assertTrue(col.contains(_actionListener));
-        assertTrue(col.contains(_valueChangeListener));
+        Assert.assertTrue(col.contains(_actionListener));
+        Assert.assertTrue(col.contains(_valueChangeListener));
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test(expected = NullPointerException.class)
     public void testRemoveFacesListenerArgNPE() throws Exception
     {
         _testImpl.removeFacesListener(null);
@@ -102,8 +110,8 @@ public class UIComponentBaseFacesListene
     public void testRemoveFacesListener() throws Exception
     {
         _testImpl.addFacesListener(_actionListener);
-        assertEquals(_actionListener, _testImpl.getFacesListeners(FacesListener.class)[0]);
+        Assert.assertEquals(_actionListener, _testImpl.getFacesListeners(FacesListener.class)[0]);
         _testImpl.removeFacesListener(_actionListener);
-        assertEquals(0, _testImpl.getFacesListeners(FacesListener.class).length);
+        Assert.assertEquals(0, _testImpl.getFacesListeners(FacesListener.class).length);
     }
 }

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseProcessSaveRestoreStateTest.java Tue Nov 19 04:26:10 2013
@@ -29,9 +29,7 @@ import javax.faces.context.FacesContext;
 
 import org.easymock.EasyMock;
 import static org.easymock.EasyMock.*;
-import static org.testng.Assert.*;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.Test;
 
 /**
  * Created by IntelliJ IDEA.
@@ -49,13 +47,20 @@ public class UIComponentBaseProcessSaveR
     private UIComponent _child;
 
     @Override
-    @BeforeMethod(alwaysRun = true)
-    protected void setUp() throws Exception
+    public void setUp() throws Exception
     {
         super.setUp();
         _facet = _mocksControl.createMock(UIComponent.class);
         _child = _mocksControl.createMock(UIComponent.class);
     }
+    
+    @Override
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+        _facet = null;
+        _child = null;
+    }
 
     @Override
     protected Collection<Method> getMockedMethods() throws Exception
@@ -71,13 +76,13 @@ public class UIComponentBaseProcessSaveR
         return methods;
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test(expected = NullPointerException.class)
     public void testSaveStateExpections() throws Exception
     {
         _testImpl.processSaveState(null);
     }
 
-    @Test(expectedExceptions = {NullPointerException.class})
+    @Test(expected = NullPointerException.class)
     public void testRestoreStateExpections() throws Exception
     {
         _testImpl.processRestoreState(null, null);

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseTest.java Tue Nov 19 04:26:10 2013
@@ -21,11 +21,8 @@ package javax.faces.component;
 
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.isNull;
 import static org.easymock.EasyMock.same;
 import static org.easymock.classextension.EasyMock.createControl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -40,9 +37,10 @@ import javax.faces.event.FacesListener;
 import javax.faces.render.Renderer;
 
 import org.easymock.classextension.IMocksControl;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Factory;
-import org.testng.annotations.Test;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 @SuppressWarnings("deprecation")
 public class UIComponentBaseTest
@@ -53,14 +51,23 @@ public class UIComponentBaseTest
     private FacesContext _facesContext;
     private Renderer _renderer;
 
-    @BeforeMethod(alwaysRun = true)
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
         _mocksControl = createControl();
         _facesContext = _mocksControl.createMock(FacesContext.class);
         _testImpl = _mocksControl.createMock(UIComponentBase.class, getMockedMethodsArray());
         _renderer = _mocksControl.createMock(Renderer.class);
     }
+    
+    @After
+    public void tearDown() throws Exception
+    {
+        _mocksControl = null;
+        _facesContext = null;
+        _testImpl = null;
+        _renderer = null;
+    }
 
     protected final Method[] getMockedMethodsArray()
     {
@@ -98,7 +105,7 @@ public class UIComponentBaseTest
     public void testGetAttributes()
     {
         // TODO implement tests for _ComponentAttributesMap
-        assertTrue(_testImpl.getAttributes() instanceof _ComponentAttributesMap);
+        Assert.assertTrue(_testImpl.getAttributes() instanceof _ComponentAttributesMap);
     }
 
     @Test
@@ -118,7 +125,7 @@ public class UIComponentBaseTest
             expect(renderer.getRendersChildren()).andReturn(expectedValue);
         }
         _mocksControl.replay();
-        assertEquals(expectedValue, _testImpl.getRendersChildren());
+        Assert.assertEquals(expectedValue, _testImpl.getRendersChildren());
         _mocksControl.verify();
         _mocksControl.reset();
     }
@@ -143,7 +150,7 @@ public class UIComponentBaseTest
 //        assertEquals(0, _testImpl.getChildCount());
 //    }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected = NullPointerException.class )
     public void testBroadcastArgNPE() throws Exception
     {
         _testImpl.broadcast(null);
@@ -169,7 +176,7 @@ public class UIComponentBaseTest
         _mocksControl.verify();
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected = NullPointerException.class)
     public void testDecodeArgNPE() throws Exception
     {
         _testImpl.decode(null);
@@ -185,7 +192,7 @@ public class UIComponentBaseTest
         _mocksControl.verify();
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected = NullPointerException.class)
     public void testEncodeBeginArgNPE() throws Exception
     {
         _testImpl.encodeBegin(null);
@@ -209,7 +216,7 @@ public class UIComponentBaseTest
 //        _mocksControl.verify();
 //    }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected = NullPointerException.class )
     public void testEncodeChildrenArgNPE() throws Exception
     {
         _testImpl.encodeChildren(null);
@@ -231,7 +238,7 @@ public class UIComponentBaseTest
         _mocksControl.verify();
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected = NullPointerException.class )
     public void testEncodeEndArgNPE() throws Exception
     {
         _testImpl.encodeEnd(null);
@@ -255,13 +262,13 @@ public class UIComponentBaseTest
 //        _mocksControl.verify();
 //    }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected = NullPointerException.class )
     public void testQueueEventArgNPE() throws Exception
     {
         _testImpl.queueEvent(null);
     }
 
-    @Test(expectedExceptions = { IllegalStateException.class })
+    @Test(expected =  IllegalStateException.class )
     public void testQueueEventWithoutParent() throws Exception
     {
         FacesEvent event = _mocksControl.createMock(FacesEvent.class);
@@ -282,13 +289,13 @@ public class UIComponentBaseTest
         _mocksControl.verify();
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected = NullPointerException.class )
     public void testProcessDecodesArgNPE() throws Exception
     {
         _testImpl.processDecodes(null);
     }
 
-    @Test(expectedExceptions = { RuntimeException.class })
+    @Test(expected =  RuntimeException.class )
     public void testProcessDecodesCallsRenderResoponseIfDecodeThrowsException()
     {
         List<UIComponent> emptyList = Collections.emptyList();
@@ -308,7 +315,7 @@ public class UIComponentBaseTest
         }
     }
 
-    @Test(enabled=false)
+    //@Test
     public void testProcessDecodesWithRenderedFalse() throws Exception
     {
         _testImpl.setRendered(false);
@@ -334,13 +341,13 @@ public class UIComponentBaseTest
 //        _mocksControl.verify();
 //    }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected = NullPointerException.class )
     public void testProcessValidatorsArgNPE() throws Exception
     {
         _testImpl.processValidators(null);
     }
 
-    @Test(enabled=false)
+    //@Test
     public void testProcessValidatorsWithRenderedFalse() throws Exception
     {
         _testImpl.setRendered(false);
@@ -370,13 +377,13 @@ public class UIComponentBaseTest
         return child;
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected =  NullPointerException.class )
     public void testProcessUpdatesArgNPE() throws Exception
     {
         _testImpl.processUpdates(null);
     }
 
-    @Test(enabled=false)
+    //@Test
     public void testProcessUpdatesWithRenderedFalse() throws Exception
     {
         _testImpl.setRendered(false);
@@ -396,6 +403,7 @@ public class UIComponentBaseTest
 //        _mocksControl.verify();
 //    }
 
+    /*
     @Factory
     public Object[] createPropertyTests() throws Exception
     {
@@ -415,5 +423,5 @@ public class UIComponentBaseTest
                         return getMocksControl().createMock(UIComponentBase.class, new Method[0]);
                     }
                 } };
-    }
+    }*/
 }

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseValueBindingTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseValueBindingTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseValueBindingTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseValueBindingTest.java Tue Nov 19 04:26:10 2013
@@ -27,9 +27,8 @@ import javax.faces.el.ValueBinding;
 import org.easymock.EasyMock;
 import static org.easymock.EasyMock.*;
 import org.easymock.IAnswer;
-import static org.testng.Assert.*;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Created by IntelliJ IDEA.
@@ -43,14 +42,20 @@ public class UIComponentBaseValueBinding
     private ValueBinding _valueBinding;
 
     @Override
-    @BeforeMethod(alwaysRun = true)
-    protected void setUp() throws Exception
+    public void setUp() throws Exception
     {
         super.setUp();
         _valueBinding = _mocksControl.createMock(ValueBinding.class);
     }
 
     @Override
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+        _valueBinding = null;
+    }
+
+    @Override
     protected Collection<Method> getMockedMethods() throws Exception
     {
         Collection<Method> mockedMethods = super.getMockedMethods();
@@ -65,7 +70,7 @@ public class UIComponentBaseValueBinding
     {
         expect(_testImpl.getValueExpression(EasyMock.eq("xxx"))).andReturn(null);
         _mocksControl.replay();
-        assertNull(_testImpl.getValueBinding("xxx"));
+        Assert.assertNull(_testImpl.getValueBinding("xxx"));
     }
 
     @Test
@@ -77,7 +82,7 @@ public class UIComponentBaseValueBinding
             public Object answer() throws Throwable
             {
                 _ValueBindingToValueExpression ve = (_ValueBindingToValueExpression) EasyMock.getCurrentArguments()[1];
-                assertEquals(_valueBinding, ve.getValueBinding());
+                Assert.assertEquals(_valueBinding, ve.getValueBinding());
                 return null;
             }
         });
@@ -99,7 +104,7 @@ public class UIComponentBaseValueBinding
         ValueExpression valueExpression = new _ValueBindingToValueExpression(_valueBinding);
         expect(_testImpl.getValueExpression(EasyMock.eq("xxx"))).andReturn(valueExpression);
         _mocksControl.replay();
-        assertEquals(_valueBinding, _testImpl.getValueBinding("xxx"));
+        Assert.assertEquals(_valueBinding, _testImpl.getValueBinding("xxx"));
     }
 
     @Test
@@ -109,8 +114,8 @@ public class UIComponentBaseValueBinding
         expect(_testImpl.getValueExpression(EasyMock.eq("xxx"))).andReturn(valueExpression);
         _mocksControl.replay();
         ValueBinding valueBinding = _testImpl.getValueBinding("xxx");
-        assertNotNull(valueBinding);
-        assertTrue(valueBinding instanceof _ValueExpressionToValueBinding);
-        assertEquals(valueExpression, ((_ValueExpressionToValueBinding) valueBinding).getValueExpression());
+        Assert.assertNotNull(valueBinding);
+        Assert.assertTrue(valueBinding instanceof _ValueExpressionToValueBinding);
+        Assert.assertEquals(valueExpression, ((_ValueExpressionToValueBinding) valueBinding).getValueExpression());
     }
 }

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTest.java Tue Nov 19 04:26:10 2013
@@ -18,10 +18,8 @@
  */
 package javax.faces.component;
 
-import static org.apache.myfaces.Assert.assertException;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.same;
-import static org.testng.Assert.assertEquals;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -30,9 +28,9 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.faces.context.FacesContext;
-
+import org.apache.myfaces.Assert;
 import org.apache.myfaces.TestRunner;
-import org.testng.annotations.Test;
+import org.junit.Test;
 
 public class UIComponentTest extends UIComponentTestBase
 {
@@ -50,13 +48,13 @@ public class UIComponentTest extends UIC
         map.put("xxx3", new UIInput());
         expect(component.getFacets()).andReturn(map);
         _mocksControl.replay();
-        assertEquals(3, component.getFacetCount());
+        org.junit.Assert.assertEquals(3, component.getFacetCount());
         _mocksControl.verify();
 
         _mocksControl.reset();
         expect(component.getFacets()).andReturn(null);
         _mocksControl.replay();
-        assertEquals(0, component.getFacetCount());
+        org.junit.Assert.assertEquals(0, component.getFacetCount());
         _mocksControl.verify();
     }
 
@@ -76,7 +74,7 @@ public class UIComponentTest extends UIC
                 .size()]));
         _mocksControl.checkOrder(true);
 
-        assertException(NullPointerException.class, new TestRunner()
+        Assert.assertException(NullPointerException.class, new TestRunner()
         {
             public void run() throws Throwable
             {
@@ -86,7 +84,7 @@ public class UIComponentTest extends UIC
 
         expect(testimpl.getClientId(same(_facesContext))).andReturn("xyz");
         _mocksControl.replay();
-        assertEquals("xyz", testimpl.getContainerClientId(_facesContext));
+        org.junit.Assert.assertEquals("xyz", testimpl.getContainerClientId(_facesContext));
         _mocksControl.verify();
     }
 }

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTestBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTestBase.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTestBase.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentTestBase.java Tue Nov 19 04:26:10 2013
@@ -22,17 +22,25 @@ import javax.faces.context.FacesContext;
 
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
-import org.testng.annotations.BeforeMethod;
+import org.junit.After;
+import org.junit.Before;
 
 public abstract class UIComponentTestBase
 {
     protected IMocksControl _mocksControl;
     protected FacesContext _facesContext;
 
-    @BeforeMethod(alwaysRun = true)
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
         _mocksControl = EasyMock.createNiceControl();
         _facesContext = _mocksControl.createMock(FacesContext.class);
     }
+    
+    @After
+    public void tearDown() throws Exception
+    {
+        _mocksControl = null;
+        _facesContext = null;
+    }
 }
\ No newline at end of file

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentValueExpressionTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentValueExpressionTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentValueExpressionTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentValueExpressionTest.java Tue Nov 19 04:26:10 2013
@@ -18,7 +18,6 @@
  */
 package javax.faces.component;
 import static org.easymock.EasyMock.expect;
-import static org.testng.Assert.*;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -34,8 +33,9 @@ import javax.faces.context.FacesContext;
 import javax.faces.el.ValueBinding;
 
 import org.easymock.EasyMock;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Test for {@link UIComponent#getValueExpression(String)}. and
@@ -47,9 +47,8 @@ public class UIComponentValueExpressionT
     private ValueExpression _expression;
     private ELContext _elContext;
 
-    @Override
-    @BeforeMethod(alwaysRun = true)
-    protected void setUp() throws Exception
+    @Before
+    public void setUp() throws Exception
     {
         super.setUp();
         Collection<Method> mockedMethods = new ArrayList<Method>();
@@ -64,19 +63,19 @@ public class UIComponentValueExpressionT
         _mocksControl.checkOrder(true);
     }
 
-    @Test(expectedExceptions = { NullPointerException.class })
+    @Test(expected =  NullPointerException.class )
     public void testValueExpressionArgumentNPE() throws Exception
     {
         _testimpl.setValueExpression(null, _expression);
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test(expected =  IllegalArgumentException.class )
     public void testValueExpressionArgumentId() throws Exception
     {
         _testimpl.setValueExpression("id", _expression);
     }
 
-    @Test(expectedExceptions = { IllegalArgumentException.class })
+    @Test(expected =  IllegalArgumentException.class )
     public void testValueExpressionArgumentsParent() throws Exception
     {
         _testimpl.setValueExpression("parent", _expression);
@@ -89,15 +88,15 @@ public class UIComponentValueExpressionT
         _mocksControl.replay();
         _testimpl.setValueExpression("xxx", _expression);
         _mocksControl.verify();
-        assertEquals(_expression, _testimpl.getValueExpression("xxx"));
+        Assert.assertEquals(_expression, _testimpl.getValueExpression("xxx"));
         _testimpl.setValueExpression("xxx", null);
         _mocksControl.verify();
 
-        assertNull(_testimpl.getValueExpression("xxx"));
-        assertNull(_testimpl.bindings);
+        Assert.assertNull(_testimpl.getValueExpression("xxx"));
+        Assert.assertNull(_testimpl.bindings);
     }
 
-    @Test(expectedExceptions = { FacesException.class })
+    @Test(expected =  FacesException.class )
     public void testValueExpressionWithExceptionOnGetValue() throws Exception
     {
         expect(_expression.isLiteralText()).andReturn(true);
@@ -121,9 +120,9 @@ public class UIComponentValueExpressionT
         expect(_testimpl.getAttributes()).andReturn(map);
         _mocksControl.replay();
         _testimpl.setValueExpression("xxx", _expression);
-        assertEquals("abc", map.get("xxx"));
+        Assert.assertEquals("abc", map.get("xxx"));
         _mocksControl.verify();
-        assertNull(_testimpl.getValueExpression("xxx"));
+        Assert.assertNull(_testimpl.getValueExpression("xxx"));
     }
 
     @Test
@@ -134,12 +133,12 @@ public class UIComponentValueExpressionT
         _mocksControl.replay();
         ValueExpression valueExpression = _testimpl.getValueExpression("xxx");
         _mocksControl.verify();
-        assertTrue(valueExpression instanceof _ValueBindingToValueExpression);
+        Assert.assertTrue(valueExpression instanceof _ValueBindingToValueExpression);
         _mocksControl.reset();
         expect(_elContext.getContext(EasyMock.eq(FacesContext.class))).andReturn(_facesContext);
         expect(valueBinding.getValue(EasyMock.eq(_facesContext))).andReturn("value");
         _mocksControl.replay();
-        assertEquals("value", valueExpression.getValue(_elContext));
+        Assert.assertEquals("value", valueExpression.getValue(_elContext));
         _mocksControl.verify();
     }
 }

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/UIGraphicTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/UIGraphicTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/UIGraphicTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/UIGraphicTest.java Tue Nov 19 04:26:10 2013
@@ -18,13 +18,12 @@
  */
 package javax.faces.component;
 
-import static org.testng.Assert.*;
-
 import javax.el.ValueExpression;
 import javax.faces.el.ValueBinding;
 
 import org.easymock.classextension.EasyMock;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
 
 @SuppressWarnings("deprecation")
 public class UIGraphicTest
@@ -35,9 +34,9 @@ public class UIGraphicTest
     {
         UIGraphic graphic = new UIGraphic();
         graphic.setValue("xxx");
-        assertEquals(graphic.getUrl(), "xxx");
+        Assert.assertEquals(graphic.getUrl(), "xxx");
         graphic.setUrl("xyz");
-        assertEquals(graphic.getValue(), "xyz");
+        Assert.assertEquals(graphic.getValue(), "xyz");
     }
 
     @Test
@@ -46,11 +45,11 @@ public class UIGraphicTest
         UIGraphic graphic = new UIGraphic();
         ValueExpression expression = EasyMock.createMock(ValueExpression.class);
         graphic.setValueExpression("url", expression);
-        assertSame(graphic.getValueExpression("value"), expression);
+        Assert.assertSame(graphic.getValueExpression("value"), expression);
 
         expression = EasyMock.createMock(ValueExpression.class);
         graphic.setValueExpression("value", expression);
-        assertSame(graphic.getValueExpression("url"), expression);
+        Assert.assertSame(graphic.getValueExpression("url"), expression);
     }
 
     @Test
@@ -59,10 +58,10 @@ public class UIGraphicTest
         UIGraphic graphic = new UIGraphic();
         ValueBinding binding = EasyMock.createMock(ValueBinding.class);
         graphic.setValueBinding("url", binding);
-        assertSame(graphic.getValueBinding("value"), binding);
+        Assert.assertSame(graphic.getValueBinding("value"), binding);
 
         binding = EasyMock.createMock(ValueBinding.class);
         graphic.setValueBinding("value", binding);
-        assertSame(graphic.getValueBinding("url"), binding);
+        Assert.assertSame(graphic.getValueBinding("url"), binding);
     }
 }

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/component/html/HtmlOutputLinkTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/component/html/HtmlOutputLinkTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/component/html/HtmlOutputLinkTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/component/html/HtmlOutputLinkTest.java Tue Nov 19 04:26:10 2013
@@ -18,8 +18,9 @@
  */
 package javax.faces.component.html;
 
-import org.testng.Assert;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
+
 
 public class HtmlOutputLinkTest
 {

Modified: myfaces/core/trunk/api/src/test/java/javax/faces/validator/_MessageUtilsTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/test/java/javax/faces/validator/_MessageUtilsTest.java?rev=1543306&r1=1543305&r2=1543306&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/test/java/javax/faces/validator/_MessageUtilsTest.java (original)
+++ myfaces/core/trunk/api/src/test/java/javax/faces/validator/_MessageUtilsTest.java Tue Nov 19 04:26:10 2013
@@ -19,7 +19,6 @@
 package javax.faces.validator;
 
 import static org.easymock.EasyMock.expect;
-import static org.testng.Assert.assertEquals;
 
 import java.util.Locale;
 
@@ -33,7 +32,8 @@ import javax.faces.component.UIViewRoot;
 import org.apache.myfaces.test.mock.MockFacesContext12;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
 
 public class _MessageUtilsTest
 {
@@ -66,7 +66,7 @@ public class _MessageUtilsTest
         expect(valueExpression.getValue(elContext)).andReturn(s);
         mocksControl.replay();
 
-        assertEquals(_MessageUtils.getErrorMessage(facesContext, "javax.faces.validator.DoubleRangeValidator.MAXIMUM",
+        Assert.assertEquals(_MessageUtils.getErrorMessage(facesContext, "javax.faces.validator.DoubleRangeValidator.MAXIMUM",
                 new Object[] { "xyz", "xxx" }).getDetail(),
                 "xxx: Validation Error: Value is greater than allowable maximum of 'xyz'");
     }