0 Replies Latest reply on Jun 25, 2013 8:56 AM by Felipe Reis

    Is there a way to use @EJB in my test classes

    Felipe Reis Newbie

      Hi!

       

      I'm trying to use @EJB to inject Stateless Beans into my test classes, but it is not working, the objects are always null.

       

      @RunWith(Arquillian.class)

      public class MyTestClass extends TestJSFUnitBase {

       

      @EJB

                protected MyStateless myStateless;

       

      @Deployment

                public static WebArchive criaDeployment() {

           // create war

           return war;

                }

       

      @Test @InitialPage("/faces/paginas/publicas/login.xhtml")

                 public void redirecionaParaPaginaDeLoginSeNaoEstiverLogado() throws IOException {

            // myStateless is always null at this point

                }

      }