I'm writing test cases for Legacy code. I have a scenario like this.
class A
{
  static final X = getUI().getResourceX();
  A(){}
  ....some methods to test....
}
I have to create spy object from class A. But while creating object it calls getUI method which returns null and it caused a NullpointerException. So, how I eliminate getting null from getUI method? 
 
     
    