Skip to content
Advertisement

How to Mocking Request from Faces Context External Context?

I have code on MainBacking.java like this :

JavaScript

I made FacesContextProvider class too and here is my FacesContextProvider.java

JavaScript

And here is my test.java

JavaScript

When I run the test i got error null on MainBacking.java:11 Please help me. Thank You.

Advertisement

Answer

Thank You for all response, I’ve solved my problem by reading this article. I didn’t know whats wrong when I’m using FacesContextProvider I’m still got null error, but when I’m using Omnifaces to set the mocked FacesContext as current instance in my test-case, the null error was solved. Thank You!

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement