vendredi 31 mars 2017

Printing statements in thenReturn of mockito

I am using Mockito to mock a certain class while writing my test cases. Is there a way to print some statements before returning a value;

when(x.callFunction(10).thenReturn(new String("Hello"));

The above statement works, however I am not able to do the following:

when(x.callFunction(10).thenReturn({
   System.out.println("Mock called---going to return hello");
   return new String("Hello");});

Aucun commentaire:

Enregistrer un commentaire