Author: pete.muir(a)jboss.org
Date: 2008-10-27 14:47:42 -0400 (Mon, 27 Oct 2008)
New Revision: 183
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
Log:
Add tests
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-10-27
14:40:29 UTC (rev 182)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-10-27
18:47:42 UTC (rev 183)
@@ -31,7 +31,7 @@
public class InstantiationByTypeTest extends AbstractTest
{
- @Test(groups="resolution") @SpecAssertion(section="4.9")
+ @Test(groups={"resolution", "beanLifecycle"})
@SpecAssertion(section="4.9")
public void testCurrentBindingTypeAssumed()
{
assert false;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java 2008-10-27
14:40:29 UTC (rev 182)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByNameTest.java 2008-10-27
18:47:42 UTC (rev 183)
@@ -5,12 +5,16 @@
import javax.webbeans.manager.Bean;
import org.jboss.webbeans.BeanImpl;
+import org.jboss.webbeans.ResolutionManager;
+import org.jboss.webbeans.injectable.InjectableField;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.beans.Cod;
+import org.jboss.webbeans.test.beans.FishFarm;
import org.jboss.webbeans.test.beans.Haddock;
import org.jboss.webbeans.test.beans.Plaice;
import org.jboss.webbeans.test.beans.Salmon;
+import org.jboss.webbeans.test.beans.ScottishFish;
import org.jboss.webbeans.test.beans.SeaBass;
import org.jboss.webbeans.test.beans.Sole;
import org.jboss.webbeans.test.beans.Tuna;
@@ -70,9 +74,18 @@
}
@Test(groups="resolution") @SpecAssertion(section="4.10.1")
- public void testNoWebBeansFound()
+ public void testNoWebBeansFound() throws Exception
{
- assert false;
+ InjectableField<ScottishFish> whiteScottishFishField = new
InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
+ Bean<Cod> codBean = new BeanImpl<Cod>(new
SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class),
getEmptyAnnotatedType(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new
SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class),
getEmptyAnnotatedType(Salmon.class), super.manager), manager);
+ manager.addBean(codBean);
+ manager.addBean(salmonBean);
+
+ ResolutionManager resolutionManager = manager.getResolutionManager();
+ resolutionManager.addInjectionPoint(whiteScottishFishField);
+
+ assert manager.resolveByName("foo").size() == 0;
}
/*
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-10-27
14:40:29 UTC (rev 182)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-10-27
18:47:42 UTC (rev 183)
@@ -236,9 +236,20 @@
}
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
- public void testNoWebBeansFound()
+ public void testNoWebBeansFound() throws Exception
{
- assert false;
+ InjectableField<ScottishFish> whiteScottishFishField = new
InjectableField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"));
+ Bean<Cod> plaiceBean = new BeanImpl<Cod>(new
SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class),
getEmptyAnnotatedType(Cod.class), super.manager), manager);
+ Bean<Salmon> salmonBean = new BeanImpl<Salmon>(new
SimpleBeanModel<Salmon>(new SimpleAnnotatedType<Salmon>(Salmon.class),
getEmptyAnnotatedType(Salmon.class), super.manager), manager);
+ Bean<Sole> soleBean = new BeanImpl<Sole>(new
SimpleBeanModel<Sole>(new SimpleAnnotatedType<Sole>(Sole.class),
getEmptyAnnotatedType(Sole.class), super.manager), manager);
+ manager.addBean(plaiceBean);
+ manager.addBean(salmonBean);
+ manager.addBean(soleBean);
+
+ ResolutionManager resolutionManager = manager.getResolutionManager();
+ resolutionManager.addInjectionPoint(whiteScottishFishField);
+
+ assert manager.resolveByType(Tuna.class, new CurrentAnnotationLiteral()).size() ==
0;
}
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
Show replies by date