-
1. Re: JSF Mockito
badr Oct 19, 2011 12:14 PM (in response to lfryc)Is there a full example showing how to use JSF Mockito? especialy how to use is to mock managed beans
Thx
-
2. Re: JSF Mockito
lfryc Oct 19, 2011 1:32 PM (in response to badr)JSF-Mockito does mock only JSF API interfaces like FacesContext, Application, etc.
For managed beans, you can use Mockito directly.
In case you are not using FacesContext directly in your bean, use just plain Mockito.
But if you use FacesContext, then you can mock using FacesMockitoRunner in following way:
-
3. Re: JSF Mockito
badr Oct 19, 2011 1:59 PM (in response to lfryc)and how we can expect result from actionListner method? should i mock ActionEvent ...
Thanks
-
4. Re: JSF Mockito
lfryc Oct 20, 2011 3:29 AM (in response to badr)When mocking, you use mock all the interfaces which you managed bean cooperates with.
But your usecase is rather validation of behavior in targetted environment.
I think this usecase is already going behind the scope of mocking and you should rather use some tools like Arquillian and/or JSFUnit.
-
5. Re: JSF Mockito
badr Oct 20, 2011 5:14 AM (in response to lfryc)Thanks a lot!
that respond to my answer ;-)
-
6. Re: JSF Mockito
badr Oct 20, 2011 5:16 AM (in response to badr)that confirm my doubt about doing that with mock