We are trying to Unit test Controllers of our Sightly components.
We are using PowerMock, Mokito and Junit.
Our Controller class extends WCMuse class as our component is in sightly. We tried to do Mock the WCMuse by @Mock annotation.
But the issue is we get NullPointerException when we try to "getProperties()". This getProperties() is a method in WCMuse class and internally uses the javax.script.Bindings class to fetch the properties.Bindings is private in the WCMuse class.
As per the errorstack, this Bindings object is null. So getproperties() is null.Hence the error. As Bindings is private so we are not able to mock it.
Let me know if there is any other way to do it ?Can WCMuse class be mocked?
Please let me know if someone has any successful implementation of JUnit testing of WCMuse.class.
Let me know if you need any other details.
Thanks in advance.
Solved! Go to Solution.