mardi 31 mars 2015

Mockito Allow different argument types to mock overloaded method

for JUnit testing I want to mock an overloaded method. There is no need to implement several methods in the mockbuilder though. I want to do something like this:



Mockito.when(mock.getSomeInfo(Mockito.any(ArgumentType1.class) OR Mockito.any(ArgumentType2.class), Mockito.any(ArgumentType3.class))).then(new Answer<AnswerType>() {..}


I know it doesn't work with the OR statement, but is there another way to do this in Mockito?


Thanks in advance!


Aucun commentaire:

Enregistrer un commentaire