Closed anthonycr closed 6 months ago
Currently, verifying parameters looks like this
verify(myInterface) { myInterface.verifyParams( verifier = { (it[0] as? Exception)?.message == "test" }, invocation = { performAction(Exception("test")) } ) }
This feels too awkward and requires force casting the parameters. A better way that requires writing more code and potentially generating some functions is
verify(myInterface) { myInterface.verifyParams( func = MyInterface::performAction param0 = eq(Exception("test")) { it.message == "test" } ) }
I'll need to create a number of iterations of the verifyParams function to match this signature
verifyParams
fun <T, P> T.verifyParams( func: T.(P) -> Unit, param0: Pair<P, (P) -> Boolean> )
The benefit of this is that type changes to a parameter will fail to compile instead of being runtime validated.
Currently, verifying parameters looks like this
This feels too awkward and requires force casting the parameters. A better way that requires writing more code and potentially generating some functions is
I'll need to create a number of iterations of the
verifyParams
function to match this signatureThe benefit of this is that type changes to a parameter will fail to compile instead of being runtime validated.