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

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Sep 25 17:01:07 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-09-25 17:01:07 -0400 (Thu, 25 Sep 2008)
New Revision: 109

Added:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecVersion.java
Modified:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecAssertion.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java
Log:
Start to update to newer spec

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java	2008-09-18 17:18:31 UTC (rev 108)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ComponentDeploymentTest.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -2,6 +2,7 @@
 
 import org.testng.annotations.Test;
 
+ at SpecVersion("20080605")
 public class ComponentDeploymentTest
 {
 

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java	2008-09-18 17:18:31 UTC (rev 108)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -23,6 +23,7 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+ at SpecVersion("20080925")
 public class ConstructorModelTest
 {
 
@@ -158,4 +159,10 @@
       
    }
    
+   @Test @SpecAssertion(section="2.7.2")
+   public void testStereotypeOnConstructor()
+   {
+	   assert false;
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java	2008-09-18 17:18:31 UTC (rev 108)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -42,6 +42,12 @@
       container = new MockContainerImpl(null);
    }
    
+   @Test @SpecAssertion(section="2.7.2")
+   public void testSingleStereotype()
+   {
+	   assert false;
+   }
+   
    @SuppressWarnings("unchecked")
    @Test
    public void testStateless()

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java	2008-09-18 17:18:31 UTC (rev 108)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodComponentModelTest.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -216,4 +216,15 @@
       assert false;
    }
    
+   @Test @SpecAssertion(section="2.7.2")
+   public void testSingleStereotype()
+   {
+	   assert false;
+   }
+   
+   @Test @SpecAssertion(section="2.7.2")
+   public void testStereotypeOnNonProducerMethod()
+   {
+	   assert false;
+   }
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java	2008-09-18 17:18:31 UTC (rev 108)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/RemoteComponentModelTest.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -33,6 +33,12 @@
       container = new MockContainerImpl(null);
    }
    
+   @Test @SpecAssertion(section="2.7.2")
+   public void testSingleStereotype()
+   {
+	   assert false;
+   }
+   
    @Test @SpecAssertion(section="3.5")
    public void testApiTypes() throws SecurityException, NoSuchMethodException
    {
@@ -97,4 +103,10 @@
       assert orangutanModel.getRemoveMethod().getMethod().getName().equals("removeOrangutan");
    }
    
+   @Test @SpecAssertion(section="2.7.2")
+   public void testStereotypeOnOtherInterface()
+   {
+	   assert false;
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java	2008-09-18 17:18:31 UTC (rev 108)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -66,6 +66,7 @@
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+ at SpecVersion("20080925")
 public class SimpleComponentModelTest
 {
    
@@ -99,7 +100,7 @@
    
    // **** TESTS FOR DEPLOYMENT TYPE **** //
    
-   @Test
+   @Test @SpecAssertion(section="2.5.3")
    public void testTooManyDeploymentTypes()
    {
       boolean exception = false;
@@ -114,7 +115,7 @@
       assert exception;
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.5.4")
    public void testXmlDeploymentTypeOverridesJava()
    {
       Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -125,7 +126,7 @@
       assert component.getDeploymentType().annotationType().equals(AnotherDeploymentType.class);
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.5.5")
    public void testXmlDefaultDeploymentType()
    {
       AnnotatedType antelopeAnnotatedItem = new SimpleAnnotatedType(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
@@ -133,15 +134,15 @@
       assert antelope.getDeploymentType().annotationType().equals(Production.class);
    }
    
-   @Test
-   public void testXmlIgnoresJavaDeploymentType()
+   @Test @SpecAssertion(section="2.5.4")
+   public void testXmlRespectsJavaDeploymentType()
    {
       AnnotatedType annotatedItem = new SimpleAnnotatedType(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
       SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new SimpleAnnotatedType(Tuna.class), annotatedItem, container);
-      assert tuna.getDeploymentType().annotationType().equals(Production.class);
+      assert tuna.getDeploymentType().annotationType().equals(AnotherDeploymentType.class);
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.5.7")
    public void testDeploymentTypePrecedenceSelection()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -153,11 +154,21 @@
       
    }
    
+   @Test @SpecAssertion(section="2.7.2")
+   public void testDeploymentTypeSpecifiedAndStereotyped()
+   {
+      Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
+      annotations.put(FishStereotype.class, new FishStereotypeBinding());
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
+      assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+   }
+   
    // **** TESTS FOR BINDING TYPE **** //
    
    @SuppressWarnings("unchecked")
-   @Test
-   public void testXmlBindingTypeOverridesJava()
+   @Test @SpecAssertion(section="2.3.5")
+   public void testXmlBindingTypeOverridesAndIgnoresJava()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(Asynchronous.class, new AsynchronousBinding());
@@ -169,7 +180,7 @@
    }
    
    @SuppressWarnings("unchecked")
-   @Test
+   @Test @SpecAssertion(section="2.3.3")
    public void testBindingTypesDeclaredInJava()
    {
       SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new SimpleAnnotatedType(Cat.class), emptyAnnotatedItem, container);
@@ -178,7 +189,7 @@
    }
    
    @SuppressWarnings("unchecked")
-   @Test
+   @Test @SpecAssertion(section="2.3.3")
    public void testBindingTypesDeclaredInXml()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -190,8 +201,8 @@
    }
    
    @SuppressWarnings("unchecked")
-   @Test
-   public void testDefaultBindingType()
+   @Test @SpecAssertion(section={"2.3.3", "2.3.1"}) 
+   public void testDefaultBindingTypeDeclaredInJava()
    {
       SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
       assert order.getBindingTypes().size() == 1;
@@ -218,7 +229,7 @@
       assert order.getScopeType().annotationType().equals(RequestScoped.class);
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.4.4")
    public void testScopeDeclaredInXmlOverridesJava()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -228,7 +239,7 @@
       assert trout.getScopeType().annotationType().equals(ConversationScoped.class);
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.4.4")
    public void testScopeMissingInXml()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -238,15 +249,15 @@
       assert trout.getScopeType().annotationType().equals(RequestScoped.class);
    }
    
-   @Test
-   public void testNoScopeSpecified()
+   @Test @SpecAssertion(section="2.4.5")
+   public void testDefaultScope()
    {
       SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
       assert order.getScopeType().annotationType().equals(Dependent.class);
    }
    
-   @Test
-   public void testTooManyScopesSpecified()
+   @Test @SpecAssertion(section="2.4.3")
+   public void testTooManyScopesSpecifiedInJava()
    {
       boolean exception = false;
       try
@@ -260,7 +271,7 @@
       assert exception;  
    }
    
-   @Test
+   @Test @SpecAssertion(section={"2.4.4", "2.4.3"})
    public void testTooManyScopesSpecifiedInXml()
    {
       boolean exception = false;
@@ -279,7 +290,7 @@
       assert exception;  
    }
    
-   @Test
+   @Test @SpecAssertion(section={"2.4.5", "2.7.2"})
    public void testScopeSpecifiedAndStereotyped()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -289,7 +300,7 @@
       assert trout.getScopeType().annotationType().equals(RequestScoped.class);
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.4.5")
    public void testMutipleIncompatibleScopeStereotypes()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -309,7 +320,7 @@
       assert exception;
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.4.5")
    public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -321,7 +332,7 @@
       assert trout.getScopeType().annotationType().equals(RequestScoped.class);     
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.4.5")
    public void testMutipleCompatibleScopeStereotypes()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -335,16 +346,16 @@
    
    // **** TESTS FOR COMPONENT NAME **** /
    
-   @Test
-   public void testNamed()
+   @Test @SpecAssertion(section="2.6.1")
+   public void testDefaultNamed()
    {
       SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), emptyAnnotatedItem, container);
       assert haddock.getName() != null;
       assert haddock.getName().equals("haddock");
    }
    
-   @Test
-   public void testXmlNamed()
+   @Test @SpecAssertion(section="2.6.2")
+   public void testDefaultXmlNamed()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(Named.class, new NamedBinding()
@@ -362,7 +373,7 @@
       assert trout.getName().equals("seaBass");
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.6.2")
    public void testNonDefaultXmlNamed()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -380,14 +391,14 @@
       assert trout.getName().equals("aTrout");
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.6.4")
    public void testNotNamed()
    {
       SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), emptyAnnotatedItem, container);
       assert trout.getName() == null;
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.6.1")
    public void testNonDefaultNamed()
    {
       SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new SimpleAnnotatedType(Moose.class), emptyAnnotatedItem, container);
@@ -398,7 +409,7 @@
    // **** TESTS FOR STEREOTYPES **** //
    
    @SuppressWarnings("unchecked")
-   @Test
+   @Test @SpecAssertion(section="2.7.3")
    public void testStereotypeDeclaredInXmlAndJava()
    {
       Map<Class<? extends Annotation>, Annotation> orderXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
@@ -421,7 +432,7 @@
       assert order.getScopeType().annotationType().equals(Dependent.class);
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.7.2")
    public void testSingleStereotype()
    {
       SimpleComponentModel<Gorilla> gorilla = new SimpleComponentModel<Gorilla>(new SimpleAnnotatedType(Gorilla.class), emptyAnnotatedItem, container);
@@ -431,7 +442,7 @@
       assert gorilla.getScopeType().annotationType().equals(RequestScoped.class);
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.7.4")
    public void testRequiredTypeIsImplemented()
    {
       try
@@ -445,23 +456,13 @@
       
    }
    
-   @Test
+   @Test(expectedExceptions=Exception.class) @SpecAssertion(section="2.7.4")
    public void testRequiredTypeIsNotImplemented()
    {
-      boolean exception = false;
-      try
-      {
-         new SimpleComponentModel<Chair>(new SimpleAnnotatedType(Chair.class), emptyAnnotatedItem, container);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
-      
+      new SimpleComponentModel<Chair>(new SimpleAnnotatedType(Chair.class), emptyAnnotatedItem, container);      
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.7.4")
    public void testScopeIsSupported()
    {
       try
@@ -470,28 +471,23 @@
       }
       catch (Exception e) 
       {
-         e.printStackTrace();
          assert false;
       }
       
    }
    
-   @Test
+   @Test(expectedExceptions=Exception.class) @SpecAssertion(section="2.7.4")
    public void testScopeIsNotSupported()
    {
-      boolean exception = false;
-      try
-      {
-         new SimpleComponentModel<Carp>(new SimpleAnnotatedType(Carp.class), emptyAnnotatedItem, container);
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
-      
+      new SimpleComponentModel<Carp>(new SimpleAnnotatedType(Carp.class), emptyAnnotatedItem, container);    
    }
    
+   @Test @SpecAssertion(section="2.7.2")
+   public void testMultipleStereotypes()
+   {
+	   assert false;
+   }
+   
    //*** COMPONENT CLASS CHECKS ****//
    
    @Test

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecAssertion.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecAssertion.java	2008-09-18 17:18:31 UTC (rev 108)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecAssertion.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -1,13 +1,15 @@
 package org.jboss.webbeans.test;
 
+import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Target;
 
 @Target(ElementType.METHOD)
+ at Documented
 public @interface SpecAssertion
 {
    
-   public String section();
+   public String[] section();
    
    public String note() default "";
 

Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecVersion.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecVersion.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecVersion.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+ at Documented
+ at Target(ElementType.TYPE)
+public @interface SpecVersion {
+	
+	String value();
+
+}


Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SpecVersion.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java	2008-09-18 17:18:31 UTC (rev 108)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java	2008-09-25 21:01:07 UTC (rev 109)
@@ -2,7 +2,6 @@
 
 import java.util.Arrays;
 
-import javax.webbeans.Component;
 import javax.webbeans.Model;
 import javax.webbeans.Production;
 import javax.webbeans.RequestScoped;
@@ -11,6 +10,7 @@
 import org.jboss.webbeans.model.StereotypeModel;
 import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
 import org.jboss.webbeans.test.annotations.AnimalStereotype;
+import org.jboss.webbeans.test.annotations.HornedMammalStereotype;
 import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
 import org.jboss.webbeans.test.annotations.broken.StereotypeWithBindingTypes;
 import org.jboss.webbeans.test.annotations.broken.StereotypeWithNonEmptyNamed;
@@ -20,26 +20,32 @@
 import org.jboss.webbeans.test.components.Order;
 import org.testng.annotations.Test;
 
+ at SpecVersion("20080925")
 public class StereotypeModelTest
 {
+	
+   @Test @SpecAssertion(section="2.7.1")
+   public void testHasCorrectTarget()
+   {
+	   assert false;
+   }
    
-   @Test
-   public void testComponentStereotype()
+   @Test @SpecAssertion(section="2.7.1")
+   public void testHasCorrectRetention()
    {
-      StereotypeModel componentStereotype = new StereotypeModel(new SimpleAnnotatedType(Component.class));
-      
-      assert Production.class.equals(componentStereotype.getDefaultDeploymentType().annotationType());
-      assert componentStereotype.getDefaultScopeType() == null;
-      assert componentStereotype.getInterceptorBindings().size() == 0;
-      assert componentStereotype.getRequiredTypes().size() == 0;
-      assert componentStereotype.getSupportedScopes().size() == 0;
-      assert !componentStereotype.isComponentNameDefaulted();
+	   assert false;
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.7.1")
+   public void testHasStereotypeAnnotation()
+   {
+	   assert false;
+   }
+   
+   @Test @SpecAssertion(section="2.7.5")
    public void testModelStereotype()
    {
-      StereotypeModel modelStereotype = new StereotypeModel(new SimpleAnnotatedType(Model.class));
+      StereotypeModel<Model> modelStereotype = new StereotypeModel<Model>(new SimpleAnnotatedType<Model>(Model.class));
       assert Production.class.equals(modelStereotype.getDefaultDeploymentType().annotationType());
       assert RequestScoped.class.equals(modelStereotype.getDefaultScopeType().annotationType());
       assert modelStereotype.isComponentNameDefaulted();
@@ -51,7 +57,7 @@
    @Test
    public void testAnimalStereotype()
    {
-      StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(AnimalStereotype.class));
+      StereotypeModel<AnimalStereotype> animalStereotype = new StereotypeModel<AnimalStereotype>(new SimpleAnnotatedType<AnimalStereotype>(AnimalStereotype.class));
       assert animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
       assert animalStereotype.getInterceptorBindings().size() == 0;
       assert animalStereotype.getRequiredTypes().size() == 1;
@@ -64,7 +70,7 @@
    @Test
    public void testAnimalOrderStereotype()
    {
-      StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(AnimalOrderStereotype.class));
+      StereotypeModel<AnimalOrderStereotype> animalStereotype = new StereotypeModel<AnimalOrderStereotype>(new SimpleAnnotatedType<AnimalOrderStereotype>(AnimalOrderStereotype.class));
       assert animalStereotype.getDefaultScopeType() == null;
       assert animalStereotype.getInterceptorBindings().size() == 0;
       assert animalStereotype.getRequiredTypes().size() == 2;
@@ -78,7 +84,7 @@
    @Test
    public void testRequestScopedAnimalStereotype()
    {
-      StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(RequestScopedAnimalStereotype.class));
+      StereotypeModel<RequestScopedAnimalStereotype> animalStereotype = new StereotypeModel<RequestScopedAnimalStereotype>(new SimpleAnnotatedType<RequestScopedAnimalStereotype>(RequestScopedAnimalStereotype.class));
       assert animalStereotype.getDefaultScopeType() == null;
       assert animalStereotype.getInterceptorBindings().size() == 0;
       assert animalStereotype.getRequiredTypes().size() == 1;
@@ -89,64 +95,55 @@
       assert animalStereotype.getDefaultDeploymentType() == null;
    }
    
-   @Test
+   @Test @SpecAssertion(section="2.7.1")
+   public void testStereotypeWithScopeType()
+   {
+	   StereotypeModel<AnimalStereotype> animalStereotype = new StereotypeModel<AnimalStereotype>(new SimpleAnnotatedType<AnimalStereotype>(AnimalStereotype.class));
+	   assert animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
+   }
+   
+   @Test @SpecAssertion(section="2.7.1")
+   public void testStereotypeWithoutScopeType()
+   {
+	   StereotypeModel<HornedMammalStereotype> animalStereotype = new StereotypeModel<HornedMammalStereotype>(new SimpleAnnotatedType<HornedMammalStereotype>(HornedMammalStereotype.class));
+	   assert animalStereotype.getDefaultScopeType().annotationType() == null;
+   }
+   
+   @Test @SpecAssertion(section="2.7.1")
+   public void testStereotypeWithoutInterceptors()
+   {
+      StereotypeModel<AnimalStereotype> animalStereotype = new StereotypeModel<AnimalStereotype>(new SimpleAnnotatedType<AnimalStereotype>(AnimalStereotype.class));
+      assert animalStereotype.getInterceptorBindings().size() == 0;
+   }
+   
+   @Test @SpecAssertion(section="2.7.1")
+   public void testStereotypeWithInterceptors()
+   {
+      assert false;
+   }
+   
+   @Test(expectedExceptions=RuntimeException.class) @SpecAssertion(section="2.7.1")
    public void testStereotypeWithTooManyScopeTypes()
    {
-      boolean exception = false;
-      try
-      {
-         new StereotypeModel(new SimpleAnnotatedType(StereotypeWithTooManyScopeTypes.class));
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      new StereotypeModel<StereotypeWithTooManyScopeTypes>(new SimpleAnnotatedType<StereotypeWithTooManyScopeTypes>(StereotypeWithTooManyScopeTypes.class));
    }
    
-   @Test
+   @Test(expectedExceptions=RuntimeException.class) @SpecAssertion(section="2.7.1")
    public void testStereotypeWithTooManyDeploymentTypes()
    {
-      boolean exception = false;
-      try
-      {
-         new StereotypeModel(new SimpleAnnotatedType(StereotypeWithTooManyDeploymentTypes.class));
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      new StereotypeModel<StereotypeWithTooManyDeploymentTypes>(new SimpleAnnotatedType<StereotypeWithTooManyDeploymentTypes>(StereotypeWithTooManyDeploymentTypes.class));
    }
    
-   @Test
+   @Test(expectedExceptions=RuntimeException.class) @SpecAssertion(section="2.7.1")
    public void testStereotypeWithNonEmptyNamed()
    {
-      boolean exception = false;
-      try
-      {
-         new StereotypeModel(new SimpleAnnotatedType(StereotypeWithNonEmptyNamed.class));
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      new StereotypeModel<StereotypeWithNonEmptyNamed>(new SimpleAnnotatedType<StereotypeWithNonEmptyNamed>(StereotypeWithNonEmptyNamed.class));
    }
    
-   @Test
+   @Test(expectedExceptions=RuntimeException.class) @SpecAssertion(section="2.7.1")
    public void testStereotypeWithBindingTypes()
    {
-      boolean exception = false;
-      try
-      {
-         new StereotypeModel(new SimpleAnnotatedType(StereotypeWithBindingTypes.class));
-      }
-      catch (Exception e) 
-      {
-         exception = true;
-      }
-      assert exception;
+      new StereotypeModel<StereotypeWithBindingTypes>(new SimpleAnnotatedType<StereotypeWithBindingTypes>(StereotypeWithBindingTypes.class));
    }
    
 }




More information about the weld-commits mailing list