2 Replies Latest reply on Nov 19, 2007 10:13 AM by djfjboss

    simulating dependency bijection with SeamTest

    djfjboss Newbie

      Following the examples in Yuan/Heute chapter 21 re the above, I cannot see how to inject a FacesMessage.

      My original class has:

      @In
      FacesMessages facesMessages;

      followed by
      facesMessages.add(...
      as per usual
      and my test class extends SeamTest.

      However I seem to need to bind the facesMessages variable explicitly within a test method in order that this variable is bound in the testing context. I therefore tried:
      setField(action, "facesMessages", FacesMessages.instance());


      But this generates an IllegalStateException, stating that there is no active conversation context (as a result of FacesMessages.instance() checking for Contexts.isConversationContextActive(), in turn accessing the thread local variable, which appears therefore to be null.

      Am I barking up the wrong tree? I had thought I would be able to get at this and other related variables via the SeamTest class but I don't see how.

      Thanks in advance.