onami-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1451916 - in /incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes: TestConcurrentLazySingleton.java TestLazySingleton.java
Date Sat, 02 Mar 2013 18:49:03 GMT
Author: simonetripodi
Date: Sat Mar  2 18:49:03 2013
New Revision: 1451916

URL: http://svn.apache.org/r1451916
Log:
@trivial: assertion methods statically imported

Modified:
    incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestConcurrentLazySingleton.java
    incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestLazySingleton.java

Modified: incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestConcurrentLazySingleton.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestConcurrentLazySingleton.java?rev=1451916&r1=1451915&r2=1451916&view=diff
==============================================================================
--- incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestConcurrentLazySingleton.java
(original)
+++ incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestConcurrentLazySingleton.java
Sat Mar  2 18:49:03 2013
@@ -19,21 +19,24 @@ package org.apache.onami.scopes;
  * under the License.
  */
 
-import com.google.inject.Guice;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Provider;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 import org.apache.onami.lifecycle.AfterInjectionModule;
 import org.apache.onami.test.OnamiRunner;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.Provider;
 
 @RunWith(OnamiRunner.class)
 public class TestConcurrentLazySingleton
@@ -94,7 +97,7 @@ public class TestConcurrentLazySingleton
     {
         Injector injector = Guice.createInjector( new ScopesModule() );
         injector.getInstance( DeadLockTester.class ); // if ConcurrentLazySingleton is not
used, this line will deadlock
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(),
1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(), 1 );
     }
 
     @Test
@@ -102,20 +105,20 @@ public class TestConcurrentLazySingleton
     {
         Injector injector = Guice.createInjector( new AfterInjectionModule(), new ScopesModule()
);
 
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(),
0 );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(),
0 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(), 0
);
 
         AnnotatedConcurrentLazySingletonObject instance =
             injector.getInstance( AnnotatedConcurrentLazySingletonObject.class );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(),
1 );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(),
1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(), 1
);
 
         AnnotatedConcurrentLazySingletonObject instance2 =
             injector.getInstance( AnnotatedConcurrentLazySingletonObject.class );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(),
1 );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(),
1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(), 1
);
 
-        Assert.assertSame( instance, instance2 );
+        assertSame( instance, instance2 );
     }
 
     @Test
@@ -123,21 +126,21 @@ public class TestConcurrentLazySingleton
     {
         Injector injector = Guice.createInjector( new AfterInjectionModule(), new ScopesModule()
);
 
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(),
0 );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(),
0 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(), 0
);
 
         InjectedAnnotatedProvider injectedProvider = injector.getInstance( InjectedAnnotatedProvider.class
);
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(),
0 );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(),
0 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(), 0
);
 
         AnnotatedConcurrentLazySingletonObject instance = injectedProvider.provider.get();
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(),
1 );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(),
1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(), 1
);
 
         AnnotatedConcurrentLazySingletonObject instance2 = injectedProvider.provider.get();
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(),
1 );
-        Assert.assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(),
1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( AnnotatedConcurrentLazySingletonObject.postConstructCount.get(), 1
);
 
-        Assert.assertSame( instance, instance2 );
+        assertSame( instance, instance2 );
     }
 }

Modified: incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestLazySingleton.java
URL: http://svn.apache.org/viewvc/incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestLazySingleton.java?rev=1451916&r1=1451915&r2=1451916&view=diff
==============================================================================
--- incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestLazySingleton.java
(original)
+++ incubator/onami/trunk/scopes/src/test/java/org/apache/onami/scopes/TestLazySingleton.java
Sat Mar  2 18:49:03 2013
@@ -19,18 +19,21 @@ package org.apache.onami.scopes;
  * under the License.
  */
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import org.apache.onami.lifecycle.AfterInjectionModule;
+import org.apache.onami.test.OnamiRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import com.google.inject.Binder;
 import com.google.inject.Guice;
 import com.google.inject.Inject;
 import com.google.inject.Injector;
 import com.google.inject.Module;
 import com.google.inject.Provider;
-import org.apache.onami.lifecycle.AfterInjectionModule;
-import org.apache.onami.test.OnamiRunner;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 
 @RunWith(OnamiRunner.class)
 public class TestLazySingleton
@@ -71,18 +74,18 @@ public class TestLazySingleton
     {
         Injector injector = Guice.createInjector( new AfterInjectionModule(), new ScopesModule()
);
 
-        Assert.assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 0 );
-        Assert.assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 0 );
+        assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 0 );
 
         AnnotatedLazySingletonObject instance = injector.getInstance( AnnotatedLazySingletonObject.class
);
-        Assert.assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 1 );
-        Assert.assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 1 );
+        assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 1 );
 
         AnnotatedLazySingletonObject instance2 = injector.getInstance( AnnotatedLazySingletonObject.class
);
-        Assert.assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 1 );
-        Assert.assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 1 );
+        assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 1 );
 
-        Assert.assertSame( instance, instance2 );
+        assertSame( instance, instance2 );
     }
 
     @Test
@@ -90,22 +93,22 @@ public class TestLazySingleton
     {
         Injector injector = Guice.createInjector( new AfterInjectionModule(), new ScopesModule()
);
 
-        Assert.assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 0 );
-        Assert.assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 0 );
+        assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 0 );
 
         InjectedAnnotatedProvider injectedProvider = injector.getInstance( InjectedAnnotatedProvider.class
);
-        Assert.assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 0 );
-        Assert.assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 0 );
+        assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 0 );
 
         AnnotatedLazySingletonObject instance = injectedProvider.provider.get();
-        Assert.assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 1 );
-        Assert.assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 1 );
+        assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 1 );
 
         AnnotatedLazySingletonObject instance2 = injectedProvider.provider.get();
-        Assert.assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 1 );
-        Assert.assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 1 );
+        assertEquals( AnnotatedLazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( AnnotatedLazySingletonObject.postConstructCount.get(), 1 );
 
-        Assert.assertSame( instance, instance2 );
+        assertSame( instance, instance2 );
     }
 
     @Test
@@ -120,18 +123,18 @@ public class TestLazySingleton
         };
         Injector injector = Guice.createInjector( new AfterInjectionModule(), new ScopesModule(),
module );
 
-        Assert.assertEquals( LazySingletonObject.constructorCount.get(), 0 );
-        Assert.assertEquals( LazySingletonObject.postConstructCount.get(), 0 );
+        assertEquals( LazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( LazySingletonObject.postConstructCount.get(), 0 );
 
         LazySingletonObject instance = injector.getInstance( LazySingletonObject.class );
-        Assert.assertEquals( LazySingletonObject.constructorCount.get(), 1 );
-        Assert.assertEquals( LazySingletonObject.postConstructCount.get(), 1 );
+        assertEquals( LazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( LazySingletonObject.postConstructCount.get(), 1 );
 
         LazySingletonObject instance2 = injector.getInstance( LazySingletonObject.class );
-        Assert.assertEquals( LazySingletonObject.constructorCount.get(), 1 );
-        Assert.assertEquals( LazySingletonObject.postConstructCount.get(), 1 );
+        assertEquals( LazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( LazySingletonObject.postConstructCount.get(), 1 );
 
-        Assert.assertSame( instance, instance2 );
+        assertSame( instance, instance2 );
     }
 
     @Test
@@ -146,21 +149,21 @@ public class TestLazySingleton
         };
         Injector injector = Guice.createInjector( new AfterInjectionModule(), new ScopesModule(),
module );
 
-        Assert.assertEquals( LazySingletonObject.constructorCount.get(), 0 );
-        Assert.assertEquals( LazySingletonObject.postConstructCount.get(), 0 );
+        assertEquals( LazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( LazySingletonObject.postConstructCount.get(), 0 );
 
         InjectedProvider injectedProvider = injector.getInstance( InjectedProvider.class
);
-        Assert.assertEquals( LazySingletonObject.constructorCount.get(), 0 );
-        Assert.assertEquals( LazySingletonObject.postConstructCount.get(), 0 );
+        assertEquals( LazySingletonObject.constructorCount.get(), 0 );
+        assertEquals( LazySingletonObject.postConstructCount.get(), 0 );
 
         LazySingletonObject instance = injectedProvider.provider.get();
-        Assert.assertEquals( LazySingletonObject.constructorCount.get(), 1 );
-        Assert.assertEquals( LazySingletonObject.postConstructCount.get(), 1 );
+        assertEquals( LazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( LazySingletonObject.postConstructCount.get(), 1 );
 
         LazySingletonObject instance2 = injectedProvider.provider.get();
-        Assert.assertEquals( LazySingletonObject.constructorCount.get(), 1 );
-        Assert.assertEquals( LazySingletonObject.postConstructCount.get(), 1 );
+        assertEquals( LazySingletonObject.constructorCount.get(), 1 );
+        assertEquals( LazySingletonObject.postConstructCount.get(), 1 );
 
-        Assert.assertSame( instance, instance2 );
+        assertSame( instance, instance2 );
     }
 }



Mime
View raw message