mockito icon indicating copy to clipboard operation
mockito copied to clipboard

Decide on the path forward once `matcher` is no longer the recommended solution

Open natebosch opened this issue 3 years ago • 2 comments

Currently argThat takes a Matcher.

Ideally it would be nice to decouple mockito from a specific matching framework, and then be be able to plug in versions of argThat using alternatives. We could continue to support using Matcher with mockito through a new package mockito_arg_matchers or something similar, and publish an alternative with a different API.

Maybe we could add something like argPredicate<T>(bool Function(T) matches), and then alternative packages could implement APIs on that.

No action needed yet, just wanted to have this on your radar @srawlins

It would be OK if we keep mockito using Matcher for at least a while - tests can use a new framework for most conditions, and import matcher just for use with argThat.

natebosch avatar Mar 31 '22 20:03 natebosch

Thanks for the heads-up!

We could continue to support using Matcher with mockito through a new package mockito_arg_matchers or something similar, and publish an alternative with a different API.

Would this specifically be done as a new package, not a new library? A new library would be simplest.

srawlins avatar Mar 31 '22 23:03 srawlins

A new package, I'll share an internal doc with more details.

natebosch avatar Mar 31 '22 23:03 natebosch