[webbeans-commits] Webbeans SVN: r3548 - ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Aug 18 09:18:52 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-08-18 09:18:51 -0400 (Tue, 18 Aug 2009)
New Revision: 3548

Added:
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Child.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/DeclaringTypeTest.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Parent.java
Log:
Add failing test

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Child.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Child.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Child.java	2009-08-18 13:18:51 UTC (rev 3548)
@@ -0,0 +1,4 @@
+package org.jboss.webbeans.test.unit.implementation.annotatedItem;
+public class Child extends Parent
+   {
+   }
\ No newline at end of file


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Child.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/DeclaringTypeTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/DeclaringTypeTest.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/DeclaringTypeTest.java	2009-08-18 13:18:51 UTC (rev 3548)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.test.unit.implementation.annotatedItem;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * @author kkahn
+ * 
+ */
+ at Artifact
+public class DeclaringTypeTest extends AbstractWebBeansTest
+{
+
+   @Test(groups="broken")
+   public void testInheritance()
+   {
+      AnnotatedType<Child> type = getCurrentManager().createAnnotatedType(Child.class);
+      assert type.getConstructors().size() == 1;
+      assert type.getFields().size() == 1;
+      for (AnnotatedField<? super Child> field : type.getFields())
+      {
+         if (field.getJavaMember().getName().equals("parent"))
+         {
+            Assert.assertEquals(Parent.class, field.getJavaMember().getDeclaringClass()); // OK
+                                                                                          // -
+                                                                                          // Returns
+                                                                                          // Parent
+            Assert.assertEquals(Parent.class, field.getDeclaringType().getJavaClass()); // FAIL
+                                                                                        // -
+                                                                                        // Returns
+                                                                                        // Child
+         }
+         else
+         {
+            Assert.fail("Unknown field " + field.getJavaMember());
+         }
+      }
+
+      assert type.getMethods().size() == 1;
+      for (AnnotatedMethod<? super Child> method : type.getMethods())
+      {
+         if (method.getJavaMember().getName().equals("parentMethod"))
+         {
+            Assert.assertEquals(Parent.class, method.getJavaMember().getDeclaringClass()); // OK
+                                                                                           // -
+                                                                                           // /Returns
+                                                                                           // Parent
+            Assert.assertEquals(Parent.class, method.getDeclaringType().getJavaClass()); // FAIL
+                                                                                         // -
+                                                                                         // Returns
+                                                                                         // Child
+         }
+         else
+         {
+            Assert.fail("Unknown method " + method.getJavaMember());
+         }
+      }
+   }
+
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/DeclaringTypeTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Parent.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Parent.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Parent.java	2009-08-18 13:18:51 UTC (rev 3548)
@@ -0,0 +1,11 @@
+package org.jboss.webbeans.test.unit.implementation.annotatedItem;
+public class Parent
+{
+   int parent;
+
+   void parentMethod()
+   {
+
+   }
+}
+


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/Parent.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the weld-commits mailing list