Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-372

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

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Activity

          People

            drallendc@gmail.com David Allen (Inactive)
            lod@shd.de Leopold Odenthal (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: