8 Replies Latest reply on May 24, 2014 12:57 PM by Roman Besolov

    Injecting EJB into tests

    Roman Besolov Newbie

      Hi all!


      I'm trying to write simple tests using arquillian and ran into a problem. Arquillian doesn't inject EJB into field annotaded by @EJB annotation. If I add "beans.xml" it works fine, but the test passes, even if I delete an annotation @Stateless from my EJB. Can anybody help me?


      I'm using gradle.


      Container: org.jboss.as:jboss-as-arquillian-container-remote:7.2.0.Final


      My EJB:

      public class HelloEJB {
          public String sayHelloEJB(String name) {
              return "Hello " + name;


      My test:

      public class HelloEJBIT {
          private HelloEJB helloEJB;
          public static JavaArchive createTestArchive() {
              return ShrinkWrap.create(JavaArchive.class)
          public void testHelloEJB() {
              String result = helloEJB.sayHelloEJB("Roman");
              assertEquals("Hello Roman", result);