For example, given the following contrived example, verifySequence will fail
foo2
because both
service.useSomething(mock, ...)
and
service.useSomething2(mock, ...)
get recorded.
val mock = mockk<Something>()
describe("foo") {
it("foo1") {
...
service.useSomething(mock, ...)
coVerifySequence {
service.useSomething(mock, ...)
}
}
it("foo2" {
...
service.useSomething2(mock, ...)
coVerifySequence {
service.useSomething2(mock, ...)
}
}
}
Verification failed: number of calls happened not matching exact number of verification sequence
java.lang.AssertionError: Verification failed: number of calls happened not matching exact number of verification sequence
...
Calls:
1) service.useSomething1(mock, ...)
2) +service.useSomething2(mock, ...)