mercredi 20 novembre 2019

Mockito: Intercepting method call without reference to object

I want to test the following example code:

public class Example {
  ...
  public void doStuff() {
    ...
    Lift lift = new Lift();
    lift.call(5);
    ...
  }
  ...
}

How can I 'intercept' lift.call(5)? Generally I would use when(lift.call(anyInt()).thenReturn(...), but I have no reference to the Lift object.

Aucun commentaire:

Enregistrer un commentaire