1 Reply Latest reply on Jul 4, 2008 2:33 PM by westdwestd.david.west.cusppoint.com

    Injecting spring mocks into seam beans during integration tests

    westdwestd.david.west.cusppoint.com

      Hi there,


      Is it possible to inject a spring bean mock into my Seam beans under test during seam integration tests?


      Note I've replace the AT and HASH and EQUALS symbols below because i can't get this message to post with them


      My seam bean under test has the following dependency:
      AT In(HASH {userService})
      UserService userService;


      I've tried mocking out the UserService as follows
      AT Name(userService)
      AT Install(precedence EQUALS Install.MOCK)
      public class UserServiceMock implements UserService..


      I've also tried
      AT Name(HASH{userService})
      AT Install(precedence EQUALS Install.MOCK)
      public class UserServiceMock implements UserService


      In both cases I get:
      Caused by: javax.el.ELException: org.jboss.seam.RequiredException: @In attribute requires non-null value: mySeamBean.HASH{userService}


      Any guidance would be greatly appreciated


      Thanks

        • 1. Re: Injecting spring mocks into seam beans during integration tests
          westdwestd.david.west.cusppoint.com

          Sorry my last post is garbled, trying again here


          Is it possible to inject a spring bean mock into my Seam beans under test during seam integration tests?


          My seam bean under test has the following dependency:


          @In("#{userService}")


          UserService userService;


          I've tried mocking out the UserService as follows


          @Name("userService")


          @Install(precedence=Install.MOCK)


          public class UserServiceMock implements UserService..


          I've also tried


          @Name("#{userService}")


          @Install(precedence=Install.MOCK)


          public class UserServiceMock implements UserService


          In both cases I get: Caused by: javax.el.ELException: org.jboss.seam.RequiredException: @In attribute requires non-null value: mySeamBean.HASH{userService}


          Any guidance would be greatly appreciated