8 Replies Latest reply on Jul 16, 2010 7:46 PM by Dennis Sidharta

    When the class under test has an @EJB annotated field

    Dennis Sidharta Newbie

      Hi all:

       

      The injection of the class under test seems to fail, i.e. it's null, when that class contains an @EJB annotated field. Here's the simplest case:

       

      {code}@Stateless public class TestingSessionBean {     public TestingSessionBean() {}     public void process() {

                // ...     } }

       

      @Named

      @RequestScoped

      public class TestingBean {

          @EJB

          private TestingSessionBean tsb;

       

          public TestingBean() {}

          public void process() {

              tsb.process();

          }

      }

       

      @RunWith(Arquillian.class)

      public class TestingBeanTest {     @Inject     private TestingBean tb;     @Deployment     public static JavaArchive createDeployment() {         return ShrinkWrap.create("test.jar", JavaArchive.class).addClasses(                 TestingBean.class, TestingSessionBean.class).addManifestResource(                 new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));     }     @Test     public void process() {

                // tb is null here.     } }{code}

       

      I'm using Arquillian 1.0.0Alpha2 and embedded JBoss AS 6.0. Did I do something wrong? I'm not sure if this is related to http://community.jboss.org/thread/152943 (not http://community.jboss.org/thread/152713). Many thanks in advance!

       

       

      Dennis