Hi everyone,
Im fairy new with
mockito and am trying to write a simple
unit test for a rest controller.
However im stuck on one particualr bit. The controller gets an instance of a static class i.e
So what I did in my unit test is return a mock that object as such
However my problem is that the getLicenseAuthentication() method of my mock object calls another private method with throws an exception in my unit test .
The exception is thrown because the attribute strategyName is null. This attribute is only set by event listeners when the application fires up in
tomcat.
I did not write this code so will be refactoring the way it works using spring security and DI.
But in the meantime is there a way in mockito that I can get it to sort of mock the checkStrategyName method?