vendredi 7 août 2015

How can I mock a local final variable

There a local variable in my method which is final. How can I mock?

public void method(){
  final int i=myService.getNumber();
}

I want to mock

when(myService.getNumber()).thenReturn(1);

How can I complete it with mocking?

My project is using Java 7, is there way using reflection or something else to realize this mock





Aucun commentaire:

Enregistrer un commentaire