wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1511872 - /wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
Date Thu, 08 Aug 2013 16:57:25 GMT
Author: gpetracek
Date: Thu Aug  8 16:57:25 2013
New Revision: 1511872

URL: http://svn.apache.org/r1511872
Log:
WINK-404 cleanup of tests which depend on the system

Modified:
    wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java

Modified: wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java?rev=1511872&r1=1511871&r2=1511872&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
(original)
+++ wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
Thu Aug  8 16:57:25 2013
@@ -29,8 +29,11 @@ import junit.framework.TestCase;
 import org.apache.wink.common.RuntimeContext;
 import org.apache.wink.common.internal.runtime.RuntimeContextTLS;
 import org.junit.Before;
+import org.junit.Test;
 
-public class JSR250OFFactoryTest extends TestCase {
+import static org.junit.Assert.assertEquals;
+
+public class JSR250OFFactoryTest {
 
     protected static String called;
     LifecycleManagersRegistry factoryRegistry;
@@ -76,7 +79,8 @@ public class JSR250OFFactoryTest extends
         public void postConstruct1() {
             called = this.getClass().getSimpleName() + ".postConstruct1()";
         }
-        @PostConstruct
+        //a 2nd @PostConstruct isn't possible and
+        //the existing test for it isn't as well since Class#getDeclaredMethods gets used
(which means that there is no guaranteed order)
         public void postConstruct2() {
             called = this.getClass().getSimpleName() + ".postConstruct2()";
         }
@@ -101,26 +105,26 @@ public class JSR250OFFactoryTest extends
         factoryRegistry = new LifecycleManagersRegistry();
         factoryRegistry.addFactoryFactory(new JSR250LifecycleManager());
     }
-    
-    @SuppressWarnings("unchecked")
+
+    @Test
     public void testCorrectOF() {
         ObjectFactory of = factoryRegistry.getObjectFactory(ProviderPostConstructSingleton.class);
         assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
     }
     
-    @SuppressWarnings("unchecked")
+    @Test
     public void testCorrectOF2() {
         ObjectFactory of = factoryRegistry.getObjectFactory(ProviderPreDestroySingleton.class);
         assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
     }
     
-    @SuppressWarnings("unchecked")
+    @Test
     public void testCorrectOF3() {
         ObjectFactory of = factoryRegistry.getObjectFactory(ProviderBothSingleton.class);
         assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
     }
     
-    @SuppressWarnings("unchecked")
+    @Test
     public void testPostConstructCalled() {
         ObjectFactory of = factoryRegistry.getObjectFactory(ProviderPostConstructSingleton.class);
         assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
@@ -129,7 +133,7 @@ public class JSR250OFFactoryTest extends
         assertEquals(called, ProviderPostConstructSingleton.class.getSimpleName() + ".postConstruct()");
     }
     
-    @SuppressWarnings("unchecked")
+    @Test
     public void testFirstPostConstructCalled() {
         ObjectFactory of = factoryRegistry.getObjectFactory(ProviderPostConstructDoubleSingleton.class);
         assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
@@ -138,7 +142,7 @@ public class JSR250OFFactoryTest extends
         assertEquals(called, ProviderPostConstructDoubleSingleton.class.getSimpleName() +
".postConstruct1()");
     }
     
-    @SuppressWarnings("unchecked")
+    @Test
     public void testPreDestroyCalled() {
         ObjectFactory of = factoryRegistry.getObjectFactory(ProviderPreDestroySingleton.class);
         assertEquals(JSR250SingletonObjectFactory.class, of.getClass());
@@ -151,7 +155,7 @@ public class JSR250OFFactoryTest extends
         assertEquals(called, ProviderPreDestroySingleton.class.getSimpleName() + ".preDestroy()");
     }
     
-    @SuppressWarnings("unchecked")
+    @Test
     public void testResource() {
         ObjectFactory of = factoryRegistry.getObjectFactory(MyResource.class);
         assertEquals(JSR250PrototypeObjectFactory.class, of.getClass());



Mime
View raw message