[webbeans-commits] Webbeans SVN: r249 - in ri/trunk/webbeans-ri/src: test/java/org/jboss/webbeans/test and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Nov 5 14:14:38 EST 2008


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

Modified:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java
Log:
Remove explicit consruction of models

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java	2008-11-05 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -48,15 +48,6 @@
     */
    public AbstractClassBeanModel(AnnotatedClass<T> annotatedItem, AnnotatedClass<T> xmlAnnotatedItem)
    {
-      if (annotatedItem == null)
-      {
-         throw new NullPointerException("annotatedItem must not be null. If the bean is declared just in XML, pass in an empty annotatedItem");
-      }
-      
-      if (xmlAnnotatedItem == null)
-      {
-         throw new NullPointerException("xmlAnnotatedItem must not be null. If the bean is declared just in Java, pass in an empty xmlAnnotatedItem");
-      }
       this.annotatedItem = annotatedItem;
       this.xmlAnnotatedItem = xmlAnnotatedItem;
    }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java	2008-11-05 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -1,7 +1,6 @@
 package org.jboss.webbeans.test;
 
 import static org.jboss.webbeans.test.util.Util.createSimpleModel;
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
 
 import java.lang.annotation.Annotation;
 import java.util.HashMap;
@@ -80,14 +79,14 @@
    }
    
    @SuppressWarnings("unchecked")
-   @Test @SpecAssertion(section="2.3.4")
+   @Test(groups="webbeansxml") @SpecAssertion(section="2.3.4")
    public void testBindingTypesDeclaredInXml()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
       AnnotatedClass annotatedItem = new SimpleAnnotatedClass(Antelope.class, annotations);
       
-      SimpleBeanModel<Antelope> antelope = new SimpleBeanModel<Antelope>(getEmptyAnnotatedType(Antelope.class), annotatedItem, manager);
+      SimpleBeanModel<Antelope> antelope = new SimpleBeanModel<Antelope>(null, annotatedItem, manager);
       assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
    }
 

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java	2008-11-05 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -1,7 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.createSimpleModel;
 import static org.jboss.webbeans.test.util.Util.createSimpleWebBean;
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
 
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
@@ -66,7 +66,7 @@
    @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.5.3")
    public void testTooManyDeploymentTypes()
    {
-      new SimpleBeanModel<BeanWithTooManyDeploymentTypes>(new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class), getEmptyAnnotatedType(BeanWithTooManyDeploymentTypes.class), manager);
+      createSimpleModel(BeanWithTooManyDeploymentTypes.class, manager);
    }
    
    @Test @SpecAssertion(section="2.5.4")
@@ -90,11 +90,11 @@
       assert tuna.getDeploymentType().equals(AnotherDeploymentType.class);
    }
    
-   @Test @SpecAssertion(section="2.5.5")
+   @Test(groups="webbeansxml") @SpecAssertion(section="2.5.5")
    public void testXmlDefaultDeploymentType()
    {
       AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
-      SimpleBeanModel<Antelope> antelope = new SimpleBeanModel<Antelope>(getEmptyAnnotatedType(Antelope.class), antelopeAnnotatedItem, manager);
+      SimpleBeanModel<Antelope> antelope = new SimpleBeanModel<Antelope>(null, antelopeAnnotatedItem, manager);
       assert antelope.getDeploymentType().equals(Production.class);
    }
    

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java	2008-11-05 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -1,7 +1,6 @@
 package org.jboss.webbeans.test;
 
 import static org.jboss.webbeans.test.util.Util.createSimpleModel;
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
 
 import java.lang.annotation.Annotation;
 import java.util.HashMap;
@@ -37,7 +36,7 @@
    @Test @SpecAssertion(section="2.6.1")
    public void testNonDefaultNamed()
    {
-      SimpleBeanModel<Moose> moose = new SimpleBeanModel<Moose>(new SimpleAnnotatedClass<Moose>(Moose.class), getEmptyAnnotatedType(Moose.class), manager);
+      SimpleBeanModel<Moose> moose = createSimpleModel(Moose.class, manager);
       assert moose.getName().equals("aMoose");
    }
    
@@ -90,7 +89,7 @@
    @Test @SpecAssertion(section={"2.6.3", "3.2.7"})
    public void testDefaultNamed()
    {
-      SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedClass<Haddock>(Haddock.class), getEmptyAnnotatedType(Haddock.class), manager);
+      SimpleBeanModel<Haddock> haddock = createSimpleModel(Haddock.class, manager);
       assert haddock.getName() != null;
       assert haddock.getName().equals("haddock");
    }
@@ -125,14 +124,14 @@
    @Test @SpecAssertion(section="2.6.4")
    public void testNotNamedInJava()
    {
-      SimpleBeanModel<SeaBass> model = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
+      SimpleBeanModel<SeaBass> model = createSimpleModel(SeaBass.class, manager);
       assert model.getName() == null;
    }
    
    @Test @SpecAssertion(section="2.6.4")
    public void testNotNamedInXml()
    {
-      SimpleBeanModel<SeaBass> model = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
+      SimpleBeanModel<SeaBass> model = createSimpleModel(SeaBass.class, manager);
       assert model.getName() == null;
    }
    

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java	2008-11-05 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -1,6 +1,6 @@
 package org.jboss.webbeans.test;
 
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
+import static org.jboss.webbeans.test.util.Util.createSimpleModel;
 
 import java.lang.reflect.Method;
 
@@ -10,7 +10,6 @@
 
 import org.jboss.webbeans.contexts.AbstractContext;
 import org.jboss.webbeans.contexts.RequestContext;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
 import org.jboss.webbeans.introspector.impl.SimpleAnnotatedMethod;
 import org.jboss.webbeans.model.bean.ProducerMethodBeanModel;
 import org.jboss.webbeans.model.bean.SimpleBeanModel;
@@ -68,7 +67,7 @@
 
    @Test(groups={"contexts", "producerMethod"}) @SpecAssertion(section="8.1")
    public void testProducerMethodReturningNullOK() throws SecurityException, NoSuchMethodException {
-      SimpleBeanModel<SpiderProducer> producer = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+      SimpleBeanModel<SpiderProducer> producer = createSimpleModel(SpiderProducer.class, manager);
       manager.getModelManager().addBeanModel(producer);
       Method nullProducer = SpiderProducer.class.getMethod("produceShelob");  
       ProducerMethodBeanModel<Tarantula> producerModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(nullProducer), manager);

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java	2008-11-05 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -1,7 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.createSimpleModel;
 import static org.jboss.webbeans.test.util.Util.createSimpleWebBean;
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
 
 import java.lang.annotation.Annotation;
 import java.util.HashMap;
@@ -67,24 +67,24 @@
    @Test @SpecAssertion(section="2.4.3")
    public void testScopeDeclaredInJava()
    {
-      SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
+      SimpleBeanModel<SeaBass> trout = createSimpleModel(SeaBass.class, manager);
       assert trout.getScopeType().equals(RequestScoped.class);
    }
    
    @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.4.3")
    public void testTooManyScopesSpecifiedInJava()
    {
-      new SimpleBeanModel<BeanWithTooManyScopeTypes>(new SimpleAnnotatedClass<BeanWithTooManyScopeTypes>(BeanWithTooManyScopeTypes.class), getEmptyAnnotatedType(BeanWithTooManyScopeTypes.class), manager);
+      createSimpleModel(BeanWithTooManyScopeTypes.class, manager);
    }
    
-   @Test(expectedExceptions=DefinitionException.class)
+   @Test(expectedExceptions=DefinitionException.class, groups="webbeansxml")
    public void testTooManyScopesSpecifiedInXml()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
       annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
       AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, annotations);
-      new SimpleBeanModel<Antelope>(getEmptyAnnotatedType(Antelope.class), antelopeAnnotatedItem, manager);
+      new SimpleBeanModel<Antelope>(null, antelopeAnnotatedItem, manager);
    }
    
    @Test @SpecAssertion(section="2.4.4")
@@ -121,7 +121,7 @@
    @Test @SpecAssertion(section="2.4.5")
    public void testDefaultScope()
    {
-      SimpleBeanModel<Order> order = new SimpleBeanModel<Order>(new SimpleAnnotatedClass<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager);
+      SimpleBeanModel<Order> order = createSimpleModel(Order.class, manager);
       assert order.getScopeType().equals(Dependent.class);
    }
    

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 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -1,7 +1,7 @@
 package org.jboss.webbeans.test;
 
+import static org.jboss.webbeans.test.util.Util.createSimpleModel;
 import static org.jboss.webbeans.test.util.Util.createSimpleWebBean;
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
 
 import java.lang.annotation.Annotation;
 import java.util.HashMap;
@@ -16,7 +16,6 @@
 import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
 import org.jboss.webbeans.injectable.InjectableParameter;
 import org.jboss.webbeans.injectable.SimpleConstructor;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
 import org.jboss.webbeans.model.bean.SimpleBeanModel;
 import org.jboss.webbeans.test.annotations.HeavyDuty;
 import org.jboss.webbeans.test.annotations.Motorized;
@@ -48,26 +47,26 @@
    @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
    public void testAbstractClassDeclaredInJavaIsNotAllowed()
    {
-      new SimpleBeanModel<Cow>(new SimpleAnnotatedClass<Cow>(Cow.class), getEmptyAnnotatedType(Cow.class), manager);
+      createSimpleModel(Cow.class, manager);
    }
    
    @Test(groups="innerClass") @SpecAssertion(section="3.2")
    public void testStaticInnerClassDeclaredInJavaAllowed()
    {
-      new SimpleBeanModel<StaticInnerBean>(new SimpleAnnotatedClass<StaticInnerBean>(StaticInnerBean.class), getEmptyAnnotatedType(StaticInnerBean.class), manager);
+      createSimpleModel(StaticInnerBean.class, manager);
    }
    
    @Test(expectedExceptions=DefinitionException.class, groups="innerClass") @SpecAssertion(section="3.2")
    public void testNonStaticInnerClassDeclaredInJavaNotAllowed()
    {
-      new SimpleBeanModel<InnerBean>(new SimpleAnnotatedClass<InnerBean>(InnerBean.class), getEmptyAnnotatedType(InnerBean.class), manager);
+      createSimpleModel(InnerBean.class, manager);
    }
    
    @SuppressWarnings("unchecked")
    @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
    public void testParameterizedClassDeclaredInJavaIsNotAllowed()
    {
-      new SimpleBeanModel<ParameterizedBean>(new SimpleAnnotatedClass<ParameterizedBean>(ParameterizedBean.class), getEmptyAnnotatedType(ParameterizedBean.class), manager);
+      createSimpleModel(ParameterizedBean.class, manager);
    }
    
    @Test(expectedExceptions=DefinitionException.class, groups={"interceptors", "decorators"}) @SpecAssertion(section="3.2")
@@ -113,22 +112,22 @@
       assert false;
    }
    
-   @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.4")
+   @Test(expectedExceptions=DefinitionException.class, groups="webbeansxml") @SpecAssertion(section="3.2.4")
    public void testAbstractClassDeclaredInXmlIsNotAllowed()
    {
-      new SimpleBeanModel<Cow>(new SimpleAnnotatedClass<Cow>(Cow.class), getEmptyAnnotatedType(Cow.class), manager);
+      
    }
    
-   @Test(groups="innerClass") @SpecAssertion(section="3.2.4")
+   @Test(groups={"innerClass", "webbeansxml"}) @SpecAssertion(section="3.2.4")
    public void testStaticInnerClassDeclaredInXmlAllowed()
    {
-      new SimpleBeanModel<StaticInnerBean>(new SimpleAnnotatedClass<StaticInnerBean>(StaticInnerBean.class), getEmptyAnnotatedType(StaticInnerBean.class), manager);
+      assert false;
    }
    
-   @Test(expectedExceptions=DefinitionException.class, groups="innerClass") @SpecAssertion(section="3.2.4")
+   @Test(expectedExceptions=DefinitionException.class, groups={"innerClass", "webbeansxml"}) @SpecAssertion(section="3.2.4")
    public void testNonStaticInnerClassDeclaredInXmlNotAllowed()
    {
-      new SimpleBeanModel<InnerBean>(new SimpleAnnotatedClass<InnerBean>(InnerBean.class), getEmptyAnnotatedType(InnerBean.class), manager);
+      assert false;
    }
    
    @Test(expectedExceptions=DefinitionException.class, groups="webbeansxml") @SpecAssertion(section="3.2.4")
@@ -152,7 +151,7 @@
    @Test @SpecAssertion(section="3.2.5.1")
    public void testInitializerAnnotatedConstructor()
    {
-      SimpleConstructor<Sheep> constructor = new SimpleBeanModel<Sheep>(new SimpleAnnotatedClass<Sheep>(Sheep.class), getEmptyAnnotatedType(Sheep.class), manager).getConstructor();
+      SimpleConstructor<Sheep> constructor = createSimpleModel(Sheep.class, manager).getConstructor();
       assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Sheep.class);
       assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 2;
       assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
@@ -175,7 +174,7 @@
    @Test @SpecAssertion(section="3.2.5.1")
    public void testImplicitConstructorUsed()
    {
-      SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedClass<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
+      SimpleConstructor<Order> constructor = createSimpleModel(Order.class, manager).getConstructor();
       assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
       assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
       assert constructor.getParameters().size() == 0;
@@ -184,7 +183,7 @@
    @Test @SpecAssertion(section="3.2.5.1")
    public void testEmptyConstructorUsed()
    {
-      SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedClass<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor();
+      SimpleConstructor<Donkey> constructor = createSimpleModel(Donkey.class, manager).getConstructor();
       assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Donkey.class);
       assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
       assert constructor.getParameters().size() == 0;
@@ -193,7 +192,7 @@
    @Test @SpecAssertion(section="3.2.5.1")
    public void testInitializerAnnotatedConstructorUsedOverEmptyConstuctor()
    {
-      SimpleConstructor<Turkey> constructor = new SimpleBeanModel<Turkey>(new SimpleAnnotatedClass<Turkey>(Turkey.class), getEmptyAnnotatedType(Turkey.class), manager).getConstructor();
+      SimpleConstructor<Turkey> constructor = createSimpleModel(Turkey.class, manager).getConstructor();
       assert constructor.getParameters().size() == 2;
       Map<Class<?>, Set<? extends Annotation>> map = new HashMap<Class<?>, Set<? extends Annotation>>();
       for (InjectableParameter<Object> parameter : constructor.getParameters())
@@ -225,17 +224,13 @@
    @Test(groups="webbeansxml") @SpecAssertion(section="3.2.5.2")
    public void testImplicitConstructorDeclaredInXmlUsed()
    {
-      SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedClass<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
-      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
-      assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
-      assert constructor.getParameters().size() == 0;
       assert false;
    }
    
    @Test(groups="webbeansxml") @SpecAssertion(section="3.2.5.2")
    public void testEmptyConstructorDeclaredInXmlUsed()
    {
-      SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedClass<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor();      assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
+      SimpleConstructor<Donkey> constructor = createSimpleModel(Donkey.class, manager).getConstructor();
       assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
       assert constructor.getParameters().size() == 0;
       assert false;
@@ -256,7 +251,7 @@
    @Test @SpecAssertion(section="3.2.5.3")
    public void testBindingTypeAnnotatedConstructor()
    {
-      SimpleConstructor<Duck> constructor = new SimpleBeanModel<Duck>(new SimpleAnnotatedClass<Duck>(Duck.class), getEmptyAnnotatedType(Duck.class), manager).getConstructor();
+      SimpleConstructor<Duck> constructor = createSimpleModel(Duck.class, manager).getConstructor();
       assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Duck.class);
       assert constructor.getParameters().size() == 2;
       Map<Class<?>, Set<? extends Annotation>> map = new HashMap<Class<?>, Set<? extends Annotation>>();
@@ -275,7 +270,7 @@
    @Test(groups="specialization") @SpecAssertion(section="3.2.6")
    public void testSpecializedClassInheritsBindingTypes()
    {
-      SimpleBeanModel<Tractor> bean = new SimpleBeanModel<Tractor>(new SimpleAnnotatedClass<Tractor>(Tractor.class), getEmptyAnnotatedType(Tractor.class), manager);
+      SimpleBeanModel<Tractor> bean = createSimpleModel(Tractor.class, manager);
       assert bean.getBindingTypes().size()==2;
       assert bean.getBindingTypes().contains( new AnnotationLiteral<Motorized>() {} );
       assert bean.getBindingTypes().contains( new AnnotationLiteral<HeavyDuty>() {} );
@@ -284,7 +279,7 @@
    @Test(groups="specialization") @SpecAssertion(section="3.2.6")
    public void testSpecializedClassInheritsName()
    {
-      SimpleBeanModel<Tractor> bean = new SimpleBeanModel<Tractor>(new SimpleAnnotatedClass<Tractor>(Tractor.class), getEmptyAnnotatedType(Tractor.class), manager);
+      SimpleBeanModel<Tractor> bean = createSimpleModel(Tractor.class, manager);
       assert bean.getName()!=null;
       assert bean.getName().equals("plough");
    }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java	2008-11-05 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -1,7 +1,6 @@
 package org.jboss.webbeans.test;
 
 import static org.jboss.webbeans.test.util.Util.createSimpleModel;
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
 
 import java.lang.annotation.Annotation;
 import java.util.Arrays;
@@ -153,7 +152,7 @@
    @Test @SpecAssertion(section={"2.7.2", "2.7.4"})
    public void testMultipleStereotypes()
    {
-      SimpleBeanModel<HighlandCow> highlandCow = new SimpleBeanModel<HighlandCow>(new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class), getEmptyAnnotatedType(HighlandCow.class), manager);
+      SimpleBeanModel<HighlandCow> highlandCow = createSimpleModel(HighlandCow.class, manager);
       assert highlandCow.getName() == null;
       assert highlandCow.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
       assert highlandCow.getScopeType().equals(RequestScoped.class);
@@ -196,25 +195,25 @@
    @Test at SpecAssertion(section="2.7.4")
    public void testRequiredTypeIsImplemented()
    {
-         new SimpleBeanModel<HighlandCow>(new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class), getEmptyAnnotatedType(HighlandCow.class), manager);
+         createSimpleModel(HighlandCow.class, manager);
    }
    
    @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.7.4")
    public void testRequiredTypeIsNotImplemented()
    {
-      new SimpleBeanModel<Chair>(new SimpleAnnotatedClass<Chair>(Chair.class), getEmptyAnnotatedType(Chair.class), manager);      
+      createSimpleModel(Chair.class, manager);      
    }
    
    @Test @SpecAssertion(section="2.7.4")
    public void testScopeIsSupported()
    {
-      new SimpleBeanModel<Goldfish>(new SimpleAnnotatedClass<Goldfish>(Goldfish.class), getEmptyAnnotatedType(Goldfish.class), manager);
+      createSimpleModel(Goldfish.class, manager);
    }
    
    @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.7.4")
    public void testScopeIsNotSupported()
    {
-      new SimpleBeanModel<Carp>(new SimpleAnnotatedClass<Carp>(Carp.class), getEmptyAnnotatedType(Carp.class), manager);    
+      createSimpleModel(Carp.class, manager);    
    }
    
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java	2008-11-05 18:56:51 UTC (rev 248)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java	2008-11-05 19:14:38 UTC (rev 249)
@@ -1,8 +1,7 @@
 package org.jboss.webbeans.test;
 
-import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
+import static org.jboss.webbeans.test.util.Util.createSimpleModel;
 
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
 import org.jboss.webbeans.model.bean.SimpleBeanModel;
 import org.jboss.webbeans.test.beans.Haddock;
 import org.testng.annotations.Test;
@@ -13,7 +12,7 @@
    @Test @SpecAssertion(section="2.6.3")
    public void testDefaultNamed()
    {
-      SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedClass<Haddock>(Haddock.class), getEmptyAnnotatedType(Haddock.class), manager);
+      SimpleBeanModel<Haddock> haddock = createSimpleModel(Haddock.class, manager);
       assert haddock.getName() != null;
       assert haddock.getName().equals("haddock");
    }




More information about the weld-commits mailing list