[jboss-user] [JBoss Tools (users)] - simulating dependency bijection with SeamTest

djfjboss do-not-reply at jboss.com
Mon Nov 19 07:19:52 EST 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105994#4105994

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105994



More information about the jboss-user mailing list