val stub = mock<SomeInterface>()
runBlocking {
testWith(stub) // testing suspending code
}
stub.inOrder {
verify().notSuspending()
// this "worked" before my change, but didn't verify order
verifyBlocking { suspending() }
// instead one had to use runBlocking { verify().suspending() }
// or val v = verify(); runBlocking { v.suspending() }
}
Changes:
Added interface KInOrder to allow extending mockito's InOrder interface:
defined verifyBlocking methods with similar definition to those in Verification
implemented interface with a decorator that takes a mockito InOrder and does blocking verification the same way as in Verification
Adjusted return types in Verification to provide KInOrder:
the implementation (KInOrderDecorator) is not internal so that the inline fun declaration continues working
Added methods to InOrderOnType that allow passing a VerificationMode.
Thank you for submitting a pull request! But first:
Why?
Changes:
KInOrder
to allow extending mockito'sInOrder
interface:verifyBlocking
methods with similar definition to those inVerification
InOrder
and does blocking verification the same way as inVerification
Verification
to provideKInOrder
:KInOrderDecorator
) is notinternal
so that theinline fun
declaration continues workingInOrderOnType
that allow passing aVerificationMode
.Thank you for submitting a pull request! But first: