[arquillian-issues] [JBoss JIRA] Created: (ARQ-372) The @EJB annotation does not work in a TestCase that extends abstract class

Leopold Odenthal (JIRA) jira-events at lists.jboss.org
Tue Feb 22 02:23:17 EST 2011


The @EJB annotation does not work in a TestCase that extends abstract class
---------------------------------------------------------------------------

                 Key: ARQ-372
                 URL: https://issues.jboss.org/browse/ARQ-372
             Project: Arquillian
          Issue Type: Bug
          Components: Runtime Enricher SPI
    Affects Versions: 1.0.0.Alpha4
         Environment: Arquillian Version 1.0.0 Alpha4
openejb 3.1
junit 4.8.2
            Reporter: Leopold Odenthal


The Problem is within a abstract class that contains @EJB annotation.
When a testcase extens that abstract class the Beans will not be injected.


Here is a example code:
 
@RunWith(Arquillian.class)
public abstract class AbstractTestContext
{
     @EJB
     protected BeanOne beanOne;
    
     @EJB
     protected BeanTwo beanTwo;
 
     @Deployment
     public static JavaArchive getContextDeployment()
     {
          return ShrinkWrap.create(JavaArchive.class, "test.jar")
               .addPackages(true, RootClass.class.getPackage())
               .addManifestResource("persistence.xml");
     }
}
 
public class MyTest extends AbstractTestContext
{
     @Test
     public void testBeanOne()
     {
          Assert.assertNotNull(beanOne);
     }
    
     @Test
     public void testBeanOne()
     {
          Assert.assertNotNull(beanOne);
     }
}
 
After searching the Arquillian code i found the code for my problem in the TestEnricher API.


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the arquillian-issues mailing list