Is there any way how to do nested matching? ```ver...
# mockk
d
Is there any way how to do nested matching?
Copy code
verify { instance.method(MyClass(any(), true)) } returns ...
Currently, I get
left matchers: [any()]
m
yep, you can do something like
Copy code
verify { instance.method(match { it.myBooleanProperty == true}) }
d
Hmm, that works well until you want something like
verify { instance.method(MyClass(any(), true, 1, "ABC", AnotherClass())) }
. Of course I can generalize your pattern but it quickly becomes quite tedious. The actual question therefore is whether my original variant will ever be supported, or if it's even feasible.
To reiterate: Is there any (planned) equivalent of mockito's
refEq
with its ability to exclude fields from comparison? https://javadoc.io/doc/org.mockito/mockito-core/2.8.47/org/mockito/ArgumentMatchers.html#refEq(T,%20java.lang.String...)
m
no, but I’d gladly review a PR about it 🙂
d
Ok, I will give it a try! Sound easy for a first-time contributor 🙂
❤️ 1
m
happy to give you pointers if you need any