The Java Mocking framework Mockito has a utility class called
There's an under the hood mechanism that does this in the preview release of ScalaMock3, but it's not currently exposed to client code.
What's your use case for this?
You might be able to achieve what you need by using
onCall documented here (under the "Predicate matching" and "Return Value" headings respectively).