Is it possible in Mockito to return the object that mocked method was called with? Without prior knowing what object it will be.
@Mock
MyObjectRepository myObjectRepository;
...
when(myObjectRepository.save(any(MyObject.class))) //save method returns normally MyObject.class object
.thenReturn(\\the object that method was called with);
I want to return the object that is passed to save method.