You can use thenAnswer
, where you can write a lambda that takes an Answer
object as parameter where you can extract the arguments of the call to addDate
:
when(foo.addDate(eq("myString"), any()))
.thenAnswer(answer ->
foo.addString(answer.getArgument(0)));
Have a look at the docs here.
CLICK HERE to find out more related problems solutions.