[webbeans-commits] Webbeans SVN: r151 - ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sat Oct 25 15:25:45 EDT 2008


Author: nickarls
Date: 2008-10-25 15:25:45 -0400 (Sat, 25 Oct 2008)
New Revision: 151

Modified:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java
Log:
Minor. Some more context tests.
Bean creation through Util

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java	2008-10-25 19:12:52 UTC (rev 150)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ContextTest.java	2008-10-25 19:25:45 UTC (rev 151)
@@ -1,7 +1,5 @@
 package org.jboss.webbeans.test;
 
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedItem;
-
 import javax.webbeans.ContextNotActiveException;
 import javax.webbeans.RequestScoped;
 import javax.webbeans.manager.Bean;
@@ -12,6 +10,7 @@
 import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.model.bean.SimpleBeanModel;
 import org.jboss.webbeans.test.components.Tuna;
+import org.jboss.webbeans.test.util.Util;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -34,13 +33,13 @@
    
    @Test(groups="contexts") @SpecAssertion(section="8.1")
    public void testGetWithCreateFalseReturnsNull() {
-      Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);      
+      Bean<Tuna> tunaBean = Util.createSimpleWebBean(Tuna.class, manager);      
       assert context.get(tunaBean, false) == null;
    }
 
    @Test(groups="contexts") @SpecAssertion(section="8.1")
    public void testGetWithCreateTrueReturnsBean() {
-      Bean<Tuna> tunaBean = new BeanImpl<Tuna>(new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), getEmptyAnnotatedItem(Tuna.class), super.manager), manager);
+      Bean<Tuna> tunaBean = Util.createSimpleWebBean(Tuna.class, manager);      
       assert context.get(tunaBean, true) != null;
    }
    
@@ -50,5 +49,26 @@
       context.get(null, false);
       assert true;
    }
+   
+   @Test(groups="contexts") @SpecAssertion(section="8.1")
+   public void testReturnsCorrectExistingBean() {
+      Bean<Tuna> tunaBean = Util.createSimpleWebBean(Tuna.class, manager);      
+      Tuna firstTuna = context.get(tunaBean, true);
+      Tuna secondTuna = context.get(tunaBean, false);
+      assert firstTuna == secondTuna;
+   }
 
+   @Test(groups="contexts") @SpecAssertion(section="8.1")
+   public void testProducerMethodReturningNullOK() {
+      // TODO
+      assert false;
+   }
+
+   @Test(groups="contexts")
+   public void testRemoveBean() {
+      Bean<Tuna> tunaBean = Util.createSimpleWebBean(Tuna.class, manager);      
+      Tuna firstTuna = context.get(tunaBean, true);
+      ((BasicContext)context).remove(manager, tunaBean);
+      assert context.get(tunaBean, false) == null;
+   }
 }




More information about the weld-commits mailing list