lundi 30 mai 2016

how to mock private static inner class?

I have a class like

public class Enclosing {

   public String methodA() {
     Inner.getContext();
     ......
   }

   private static class Inner{
     // some context init
     public Context getContext() {
       .....
     }
   }
}

Now I want to test methodA without invoking the real Inner.getContext(). I have been searching all over but cannot find a working solution. I am using Java 8. Can I have some help please? Many thanks

Aucun commentaire:

Enregistrer un commentaire