jeudi 26 novembre 2015

Multiple thenReturn not working properly in the Mockito

I'm testing a method that call same method (db.getData()) twice. But I must return two different values.

       Mockito.when(db.someMethod()).thenReturn(valueOne).thenReturn(valueTwo);

Then I tried out multiple thenReturn().

Unfortunately I'm getting only valueTwo for first & second db.getData() method call.

Aucun commentaire:

Enregistrer un commentaire