env: jsf unit 2.0.0.Beta2, arq 1.0.0.CR7, jboss as 7.0.2.Final
I have a CDI request scope bean which is injected and altered in one of my JSF PhaseListener on the server side.
I use the Inject annotation in my unit test class to get a reference to this bean.
When I assert the cdi bean's properties values in my test case (which have been modified by my server side PhaseListener), they fail.
If I change the CDI scope to SessionScoped they still fail. If I change the CDI Scope to ApplicationScoped then my assertions are ok.
If I use my CDI bean with @RequestScope in a facelet page and dump properties to h:outputText and test the UIComponent in JSFUnit, then my assertions are Ok.
If I use my CDI bean with @RequestScope in a facelet page and dump properties to h:outputText and use the JSFClientSession.getPageAsText() method, I can see that the properties have been properly altered by my PhaseListener.
I don't understand exactly what's happening, it looks like some of the CDI contexts get flushed before I have a chance to make my assertions on the cdi bean injected in my unit test. Any explanations are welcome.
Thanks,