Normally when using mockito I will do something like
Mockito.when(myObject.myFunction(myParameter)).thenReturn(myResult);
Is it possible to do
You can do this with Mockito 3.6.0:
when(mockObject.myMethod(anyString())) .thenAnswer(invocation -> myStringMethod(invocation.getArgument(0)));
This answer is based on Sven's answer and Martijn Hiemstra's comment, with getArgumentAt() changed to getArgument().
getArgumentAt()
getArgument()