(no commit message)
[utils] / support / cdi / src / test / java / org / wamblee / cdi / WeldTest.java
index c8608825d240a13c1b8538ac4a3e1629448c8af3..a6d0eb64381ba4a754075edae2969587595a4d61 100644 (file)
@@ -1,40 +1,35 @@
 package org.wamblee.cdi;
 
+import static junit.framework.Assert.*;
+
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.InjectionTarget;
 
-import org.jboss.weld.environment.se.Weld;
-import org.jboss.weld.environment.se.WeldContainer;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import static junit.framework.TestCase.*;
 
 public class WeldTest {
     
-    private Weld weld;
-    private WeldContainer container; 
-    private BeanManager beanManager; 
-
+    private BeanManagerSetup setup; 
+    
     @Before
     public void setUp() {
-        weld = new Weld();
-        container = weld.initialize(); 
-        beanManager = container.getBeanManager();
+        setup = new BeanManagerSetup(); 
+        setup.initialize(); 
     }
     
     @After
     public void tearDown() { 
-        weld.shutdown(); 
+        setup.shutdown();
     }
     
     @Test
     public void testGetSingleton() { 
-        AnnotatedType<MyPojo> type = beanManager.createAnnotatedType(MyPojo.class);
-        InjectionTarget<MyPojo> target = beanManager.createInjectionTarget(type);
-        CreationalContext<MyPojo> ctx = beanManager.createCreationalContext(null);
+        AnnotatedType<MyPojo> type = setup.getBeanManager().createAnnotatedType(MyPojo.class);
+        InjectionTarget<MyPojo> target = setup.getBeanManager().createInjectionTarget(type);
+        CreationalContext<MyPojo> ctx = setup.getBeanManager().createCreationalContext(null);
         
         MyPojo pojo = new MyPojo();