Author: mgrigorov
Date: Fri Nov 11 08:47:05 2011
New Revision: 1200769

URL: http://svn.apache.org/viewvc?rev=1200769&view=rev
Log:
WICKET-3979 Upgrade Wicket's tests to JUnit4


Modified:
    
wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java
    
wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactoryTest.java

Modified: 
wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java?rev=1200769&r1=1200768&r2=1200769&view=diff
==============================================================================
--- 
wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java
 (original)
+++ 
wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/SpringBeanLocatorTest.java
 Fri Nov 11 08:47:05 2011
@@ -16,11 +16,12 @@
  */
 package org.apache.wicket.spring;
 
-import junit.framework.TestCase;
-
 import org.apache.wicket.spring.test.ApplicationContextMock;
 import org.apache.wicket.spring.test.SpringContextLocatorMock;
 import org.apache.wicket.util.lang.WicketObjects;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests {@link SpringBeanLocator}
@@ -28,22 +29,17 @@ import org.apache.wicket.util.lang.Wicke
  * @author ivaynberg
  * 
  */
-public class SpringBeanLocatorTest extends TestCase
+public class SpringBeanLocatorTest extends Assert
 {
-       /**
-        * @param name
-        */
-       public SpringBeanLocatorTest(final String name)
-       {
-               super(name);
-       }
-
        private ApplicationContextMock ctx;
 
        private ISpringContextLocator ctxLocator;
 
-       @Override
-       protected void setUp() throws Exception
+       /**
+        * 
+        */
+       @Before
+       public void before()
        {
                ctx = new ApplicationContextMock();
                ctxLocator = new SpringContextLocatorMock(ctx);
@@ -52,6 +48,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests lookup of beans by class only
         */
+       @Test
        public void testLookupByClass()
        {
                Bean bean = new Bean();
@@ -65,6 +62,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests if lookup by class is still working after deserialization
         */
+       @Test
        public void testLookupByClassAfterDeserialization()
        {
                Bean bean = new Bean();
@@ -80,6 +78,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests error if bean with class is not in the context
         */
+       @Test
        public void testLookupByClassNotFound()
        {
                SpringBeanLocator locator = new SpringBeanLocator(Bean.class, 
ctxLocator);
@@ -97,6 +96,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests error when more then one bean of the same class found
         */
+       @Test
        public void testLookupByClassTooManyFound()
        {
                Bean bean = new Bean();
@@ -119,6 +119,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests lookup by name
         */
+       @Test
        public void testLookupByName()
        {
                Bean bean = new Bean();
@@ -132,6 +133,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests lookup by name after locator has been deserialized
         */
+       @Test
        public void testLookupByNameAfterDeserialization()
        {
                Bean bean = new Bean();
@@ -146,6 +148,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests error if no bean with name found
         */
+       @Test
        public void testLookupByNameNotFound()
        {
                SpringBeanLocator locator = new SpringBeanLocator("bean", 
Bean.class, ctxLocator);
@@ -163,6 +166,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests constructor argument checks
         */
+       @Test
        public void testConstructorArguments()
        {
                try
@@ -189,6 +193,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests error when context not found
         */
+       @Test
        public void testContextNotFound()
        {
                SpringContextLocatorMock ctxLocator = new 
SpringContextLocatorMock(null);
@@ -206,6 +211,7 @@ public class SpringBeanLocatorTest exten
        /**
         * tests equals and hashcode contracts
         */
+       @Test
        public void testEqualsAndHashcode()
        {
                SpringBeanLocator a = new SpringBeanLocator("bean", 
SpringBeanLocator.class, ctxLocator);

Modified: 
wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactoryTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactoryTest.java?rev=1200769&r1=1200768&r2=1200769&view=diff
==============================================================================
--- 
wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactoryTest.java
 (original)
+++ 
wicket/trunk/wicket-spring/src/test/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactoryTest.java
 Fri Nov 11 08:47:05 2011
@@ -18,8 +18,6 @@ package org.apache.wicket.spring.injecti
 
 import java.lang.reflect.Field;
 
-import junit.framework.TestCase;
-
 import org.apache.wicket.proxy.ILazyInitProxy;
 import org.apache.wicket.spring.ISpringContextLocator;
 import org.apache.wicket.spring.SpringBeanLocator;
@@ -27,6 +25,8 @@ import org.apache.wicket.spring.injectio
 import org.apache.wicket.spring.injection.util.Bean2;
 import org.apache.wicket.spring.injection.util.Injectable;
 import org.apache.wicket.spring.test.ApplicationContextMock;
+import org.junit.Assert;
+import org.junit.Test;
 import org.springframework.context.ApplicationContext;
 
 /**
@@ -35,7 +35,7 @@ import org.springframework.context.Appli
  * @author igor
  * 
  */
-public class AnnotProxyFieldValueFactoryTest extends TestCase
+public class AnnotProxyFieldValueFactoryTest extends Assert
 {
        ISpringContextLocator mockCtxLocator = new ISpringContextLocator()
        {
@@ -59,6 +59,7 @@ public class AnnotProxyFieldValueFactory
         * 
         * @throws Exception
         */
+       @Test
        public void testFactory() throws Exception
        {
                SpringBeanLocator locator = null;
@@ -89,6 +90,7 @@ public class AnnotProxyFieldValueFactory
         * 
         * @throws Exception
         */
+       @Test
        public void testCache() throws Exception
        {
                Field field = obj.getClass().getDeclaredField("beanByClass");
@@ -105,6 +107,7 @@ public class AnnotProxyFieldValueFactory
        /**
         * Test creation fails with null springcontextlocator
         */
+       @Test
        public void testNullContextLocator()
        {
                try
@@ -121,6 +124,7 @@ public class AnnotProxyFieldValueFactory
        /**
         * @throws Exception
         */
+       @Test
        public void testFailsIfBeanWithIdIsNotFound() throws Exception
        {
                InjectableWithReferenceToNonexistingBean obj = new 
InjectableWithReferenceToNonexistingBean();


Reply via email to