I'm using Mockito for unit testing a class methods. However, If my test method uses some Helper/Utils class methods then I'm spying on that Helper/Utils class objects.In some cases I also need to stub the spy object methods for checking the exceptions. I use
@Spy
private itemsDetailsHelper
doReturn(null).when(itemsDetailsHelper).getDistinctItemsList(itemDetails);
But the method is not returning null
.
Aucun commentaire:
Enregistrer un commentaire