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

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Nov 5 19:21:15 EST 2008


Author: pete.muir at jboss.org
Date: 2008-11-05 19:21:14 -0500 (Wed, 05 Nov 2008)
New Revision: 252

Modified:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanLifecycleTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
Log:
Clean up and stub tests for producer methods

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java	2008-11-05 23:42:05 UTC (rev 251)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InitializerMethodTest.java	2008-11-06 00:21:14 UTC (rev 252)
@@ -74,7 +74,7 @@
       assert chickenHutch.chicken != null;
    }
    
-   @Test(groups="initializerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.7.1")
+   @Test(groups="initializerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section={"3.7.1", "3.4.2"})
    public void testInitializerMethodAnnotatedProduces()
    {
       createSimpleWebBean(Pheasant.class, manager);

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanLifecycleTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanLifecycleTest.java	2008-11-05 23:42:05 UTC (rev 251)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanLifecycleTest.java	2008-11-06 00:21:14 UTC (rev 252)
@@ -5,21 +5,21 @@
 public class ProducerExpressionBeanLifecycleTest
 {
 
-   @Test(groups={"beanLifecycle", "producerMethod"}) @SpecAssertion(section="3.4")
+   @Test(groups={"beanLifecycle", "producerMethod", "webbeansxml"}) @SpecAssertion(section="3.4")
    public void testNonDependentProducerExpressionThatReturnsNull()
    {
       // TODO Placeholder
       assert false;
    }
    
-   @Test(groups={"beanLifecycle", "producerMethod"}) @SpecAssertion(section="3.4")
+   @Test(groups={"beanLifecycle", "producerMethod", "webbeansxml"}) @SpecAssertion(section="3.4")
    public void testDependentProducerExpressionThatReturnsNull()
    {
       // TODO Placeholder
       assert false;
    }
    
-   @Test(groups={"beanLifecycle", "producerMethod"}) @SpecAssertion(section="3.4")
+   @Test(groups={"beanLifecycle", "producerMethod", "webbeansxml"}) @SpecAssertion(section="3.4")
    public void testProducerExpressionHasValidRuntimeApiType()
    {
       // TODO Placeholder

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanModelTest.java	2008-11-05 23:42:05 UTC (rev 251)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerExpressionBeanModelTest.java	2008-11-06 00:21:14 UTC (rev 252)
@@ -5,25 +5,25 @@
 public class ProducerExpressionBeanModelTest extends AbstractTest
 {
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+   @Test(groups={"producerMethod", "webbeansxml"}) @SpecAssertion(section="3.4")
    public void testApiTypes()
    {
       assert false;
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+   @Test(groups={"producerMethod", "webbeansxml"}) @SpecAssertion(section="3.4")
    public void testFinalProducerExpression()
    {
       assert false;
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+   @Test(groups={"producerMethod", "webbeansxml"}) @SpecAssertion(section="3.4")
    public void testFinalDependentProducerExpression()
    {
       assert false;
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+   @Test(groups={"producerMethod", "webbeansxml"}) @SpecAssertion(section="3.4.2")
    public void testProducerExpressionCannotHaveDefaultName()
    {
       assert false;

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java	2008-11-05 23:42:05 UTC (rev 251)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java	2008-11-06 00:21:14 UTC (rev 252)
@@ -5,7 +5,7 @@
 import java.lang.reflect.Method;
 
 import javax.webbeans.Current;
-import javax.webbeans.Dependent;
+import javax.webbeans.DefinitionException;
 
 import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
 import org.jboss.webbeans.introspector.impl.SimpleAnnotatedMethod;
@@ -18,12 +18,9 @@
 import org.jboss.webbeans.test.beans.DaddyLongLegs;
 import org.jboss.webbeans.test.beans.DeadlyAnimal;
 import org.jboss.webbeans.test.beans.DeadlySpider;
-import org.jboss.webbeans.test.beans.LadybirdSpider;
 import org.jboss.webbeans.test.beans.Spider;
 import org.jboss.webbeans.test.beans.SpiderProducer;
 import org.jboss.webbeans.test.beans.Tarantula;
-import org.jboss.webbeans.test.beans.TrapdoorSpider;
-import org.jboss.webbeans.test.beans.broken.BeanWithFinalProducerMethod;
 import org.jboss.webbeans.test.beans.broken.BeanWithStaticProducerMethod;
 import org.testng.annotations.Test;
 
@@ -40,31 +37,76 @@
       tarantulaModel.getDeploymentType().equals(AnotherDeploymentType.class);
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.3")
-   public void testStaticMethod() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+   public void testStaticMethod() throws Exception
    {
       SimpleBeanModel<BeanWithStaticProducerMethod> model = new SimpleBeanModel<BeanWithStaticProducerMethod>(new SimpleAnnotatedClass<BeanWithStaticProducerMethod>(BeanWithStaticProducerMethod.class), getEmptyAnnotatedType(BeanWithStaticProducerMethod.class), manager);
       manager.getModelManager().addBeanModel(model);
       Method method = BeanWithStaticProducerMethod.class.getMethod("getString");
-      boolean exception = false;
-      try
-      {
-         new ProducerMethodBeanModel<String>(new SimpleAnnotatedMethod<String>(method), manager);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      new ProducerMethodBeanModel<String>(new SimpleAnnotatedMethod<String>(method), manager);
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.3")
-   public void testApiTypes() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+   public void testProducerMethodIsNotBusinessMethod() throws Exception
    {
+      assert false;
+   }
+   
+   
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+   public void testProducerMethodReturnsNullIsDependent()
+   {
+      assert false;
+   }
+   
+   @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+   public void testProducerMethodReturnsNullIsNotDependent()
+   {
+      
+   }
+   
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+   public void testParameterizedReturnType()
+   {
+      assert false;
+   }
+   
+   @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+   public void testParameterizedReturnTypeWithWildcard()
+   {
+      assert false;
+   }
+   
+   @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+   public void testParameterizedReturnTypeWithTypeParameter()
+   {
+      assert false;
+   }
+   
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+   public void testBeanDeclaresMultipleProducerMethods()
+   {
+      
+   }
+   
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4")
+   public void testDefaultBindingType() throws Exception
+   {
       SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
       manager.getModelManager().addBeanModel(model);
       Method method = SpiderProducer.class.getMethod("produceTarantula");
       ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
+      assert tarantulaModel.getBindingTypes().size() == 1;
+      assert tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
+   }
+   
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
+   public void testApiTypeForClassReturn() throws Exception
+   {
+      SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+      manager.getModelManager().addBeanModel(model);
+      Method method = SpiderProducer.class.getMethod("produceTarantula");
+      ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
       assert tarantulaModel.getApiTypes().contains(Tarantula.class);
       assert tarantulaModel.getApiTypes().contains(DeadlySpider.class);
       assert tarantulaModel.getApiTypes().contains(Spider.class);
@@ -73,20 +115,21 @@
       assert !tarantulaModel.getApiTypes().contains(Object.class);
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.3.1")
-   public void testDefaultBindingType() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
+   public void testApiTypeForPrimitiveReturn() throws Exception
    {
-      SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
-      manager.getModelManager().addBeanModel(model);
-      Method method = SpiderProducer.class.getMethod("produceTarantula");
-      ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
-      assert tarantulaModel.getBindingTypes().size() == 1;
-      assert tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Current.class);
+      assert false;
    }
    
-   @Test(groups="producerMethod")
-   public void testBindingType() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.1")
+   public void testApiTypeForArrayTypeReturn() throws Exception
    {
+      assert false;
+   }
+   
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+   public void testBindingType() throws Exception
+   {
       SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
       manager.getModelManager().addBeanModel(model);
       Method method = SpiderProducer.class.getMethod("produceTameTarantula");
@@ -95,36 +138,20 @@
       assert tarantulaModel.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.3")
-   public void testFinalMethod() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+   public void testScopeType() throws Exception
    {
-      SimpleBeanModel<BeanWithFinalProducerMethod> model = new SimpleBeanModel<BeanWithFinalProducerMethod>(new SimpleAnnotatedClass<BeanWithFinalProducerMethod>(BeanWithFinalProducerMethod.class), getEmptyAnnotatedType(BeanWithFinalProducerMethod.class), manager);
-      manager.getModelManager().addBeanModel(model);
-      Method method = BeanWithFinalProducerMethod.class.getMethod("getString");
-      boolean exception = false;
-      try
-      {
-         new ProducerMethodBeanModel<String>(new SimpleAnnotatedMethod<String>(method), manager);     
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      assert false;
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.3")
-   public void testFinalMethodWithDependentScope() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+   public void testDeploymentType() throws Exception
    {
-      SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
-      manager.getModelManager().addBeanModel(model);
-      Method method = SpiderProducer.class.getMethod("produceTrapdoorSpider");
-      ProducerMethodBeanModel<TrapdoorSpider> trapdoorSpiderModel = new ProducerMethodBeanModel<TrapdoorSpider>(new SimpleAnnotatedMethod<TrapdoorSpider>(method), manager);
-      assert trapdoorSpiderModel.getScopeType().equals(Dependent.class);
+      assert false;
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.3.6")
-   public void testNamedMethod() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+   public void testNamedMethod() throws Exception
    {
       SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
       manager.getModelManager().addBeanModel(model);
@@ -133,8 +160,8 @@
       assert blackWidowSpiderModel.getName().equals("blackWidow");
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.3.6")
-   public void testDefaultNamedMethod() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod") @SpecAssertion(section="3.4.2")
+   public void testDefaultNamedMethod() throws Exception
    {
       SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
       manager.getModelManager().addBeanModel(model);
@@ -143,16 +170,24 @@
       assert daddyLongLegsSpiderModel.getName().equals("produceDaddyLongLegs");
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.3.6")
-   public void testDefaultNamedJavaBeanMethod() throws SecurityException, NoSuchMethodException
+   @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+   public void testProducerMethodAnnotatedObserver()
    {
-      SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
-      manager.getModelManager().addBeanModel(model);
-      Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
-      ProducerMethodBeanModel<LadybirdSpider> ladybirdSpiderModel = new ProducerMethodBeanModel<LadybirdSpider>(new SimpleAnnotatedMethod<LadybirdSpider>(method), manager);
-      assert ladybirdSpiderModel.getName().equals("ladybirdSpider");
+      assert false;
    }
    
+   @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+   public void testProducerMethodWithParameterAnnotatedDisposes()
+   {
+      assert false;
+   }
+   
+   @Test(groups="producerMethod", expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.4")
+   public void testProducerMethodWithParameterAnnotatedObserves()
+   {
+      assert false;
+   }
+   
    @Test(groups="disposalMethod") @SpecAssertion(section="3.3.4")
    public void testDisposalMethodNonStatic()
    {
@@ -213,15 +248,9 @@
       assert false;
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="2.7.2")
+   @Test(groups="producerMethod") @SpecAssertion(section={"2.7.2", "3.4.2"})
    public void testSingleStereotype()
    {
 	   assert false;
    }
-   
-   @Test(groups="producerMethod") @SpecAssertion(section="2.7.2")
-   public void testStereotypeOnNonProducerMethod()
-   {
-	   assert false;
-   }
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java	2008-11-05 23:42:05 UTC (rev 251)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java	2008-11-06 00:21:14 UTC (rev 252)
@@ -94,19 +94,19 @@
       assert bean.getTypes().contains(DeadlyAnimal.class);
    }
    
-   @Test(groups="producerMethod") @SpecAssertion(section="3.2.4")
+   @Test(groups={"producerMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
    public void testBeanDeclaredInXmlIgnoresProducerMethodDeclaredInJava()
    {
       assert false;
    }
    
-   @Test(groups="disposalMethod") @SpecAssertion(section="3.2.4")
+   @Test(groups={"disposalMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
    public void testBeanDeclaredInXmlIgnoresDisposalMethodDeclaredInJava()
    {
       assert false;
    }
    
-   @Test(groups="observerMethod") @SpecAssertion(section="3.2.4")
+   @Test(groups={"observerMethod", "webbeansxml"}) @SpecAssertion(section="3.2.4")
    public void testBeanDeclaredInXmlIgnoresObserverMethodDeclaredInJava()
    {
       assert false;




More information about the weld-commits mailing list