Mockito's Answer in ScalaTest
问题 Is there some alternative to Mockito's Answer in ScalaTest? I was going through its documentation, but didn't find anything. I would like to, for example, execute some logic on arguments of a stubbed method. In Mockito, I would do something like this: when(mock.create(any(A.class))).thenAnswer(new Answer() { Object answer(InvocationOnMock invocation) { A firstArg = (A) invocation.getArguments()[0]; firstArg.callMethod(); return null; } }); In ScalaTest, I'm fine with using Mockito, as well.