I have a final class, something like this:
public final class RainOnTrees{
public void startRain(){
// some code here
}
}
I
For final class add below to mock and call static or non static.
1- add this in class level
@SuppressStatucInitializationFor(value ={class name with package})
2- PowerMockito.mockStatic(classname.class) will mock class
3- then use your when statement to return mock object when calling method of this class.
Enjoy