(no commit message)
authorErik Brakkee <erik@brakkee.org>
Thu, 22 Jul 2010 17:29:43 +0000 (17:29 +0000)
committerErik Brakkee <erik@brakkee.org>
Thu, 22 Jul 2010 17:29:43 +0000 (17:29 +0000)
support/cdi/src/test/java/org/wamblee/cdi/InjectorFactoryBuilderTest.java
support/cdi/src/test/java/org/wamblee/cdi/SimpleInjectorTest.java
support/cdi/src/test/java/org/wamblee/cdi/WeldTest.java

index 0caeed85e99f62a48cdb75b4797f50651282caae..5fdc111e74bc82e74335027acf8f87660481c33f 100644 (file)
@@ -17,9 +17,13 @@ package org.wamblee.cdi;
 
 import static junit.framework.Assert.*;
 
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
 import javax.naming.InitialContext;
 
 import org.junit.Test;
+import org.wamblee.cdi.SimpleInjectorTest.X;
+import org.wamblee.cdi.SimpleInjectorTest.Y;
 import org.wamblee.inject.InjectorFactory;
 import org.wamblee.inject.InjectorFactoryBuilder;
 import org.wamblee.test.jndi.StubInitialContextFactory;
index d7df81aae2aefedccf4f145cf0e3af009e8195c3..f9e77a5deb116489c513ef017afb162b09267db7 100644 (file)
@@ -18,6 +18,8 @@ package org.wamblee.cdi;
 import static junit.framework.Assert.*;
 import static org.mockito.Mockito.*;
 
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
 import javax.naming.InitialContext;
 
 import org.junit.After;
@@ -25,6 +27,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.wamblee.inject.Injector;
 import org.wamblee.inject.InjectorFactory;
+import org.wamblee.inject.InjectorFactoryBuilder;
 import org.wamblee.inject.SimpleInjector;
 import org.wamblee.test.jndi.StubInitialContextFactory;
 
@@ -87,4 +90,29 @@ public class SimpleInjectorTest extends BaseTestFixture {
         // verify the custom injector was called. 
         assertSame(singleton, pojo.getSingleton());
     }
+    
+    @RequestScoped
+    public static class Y { 
+        
+    }
+    public static class X { 
+        @Inject
+        private Y y; 
+        
+    }
+    
+    @Test 
+    public void testInjectStorage() throws Exception { 
+        X x = new X(); 
+        InjectorFactoryBuilder.setInjectorFactory(null);
+        InjectorFactoryBuilder.getInjector().inject(x);
+    }
+    
+    @Test 
+    public void testInjectStorage2() { 
+        X x = new X(); 
+        InjectorFactoryBuilder.setInjectorFactory(null);
+        InjectorFactoryBuilder.getInjector().inject(x);
+    }
+    
 }
index 57fa4ad247ddccf41bdff9b3fcdc48a554289e43..640608377a282edbca17c34ed9f940058f2245ae 100644 (file)
@@ -48,4 +48,9 @@ public class WeldTest {
 
         assertEquals(1, MySingleton.getInstances());
     }
+    
+    @Test
+    public void testAgain() { 
+        testGetSingleton();
+    }
 }