Anton Afanasev
05/07/2021, 2:59 PMVerification failed: calls are not exactly matching verification sequence
which is fine.
However the error message is not descriptive.
It points to the high level problem (something wrong with whole sequence) instead of saying something like: "Hey, your sequence failed because of argument matching here"
Are there a way to get more descriptive message when something like that happens? Is it me that incorrectly structure the test.
Attaching simplified version of the test:
@Test
fun `when connect`() {
// When
subject.connect()
// Then
verifySequence {
mockStateListener(State.CONNECTING)
mockPlatformSocket.openSocket(any())
}
}
And the error:
Verification failed: calls are not exactly matching verification sequence
Matchers:
Function1(#1).invoke(eq(CONNECTING)))
+PlatformSocket(#2).openSocket())
Calls:
1) Function1(#1).invoke(CONNECTED)
2) +PlatformSocket(#2).openSocket()
Stack traces:
Mattia Tommasone
05/07/2021, 3:01 PMAnton Afanasev
05/07/2021, 3:17 PMVerification failed: calls are not exactly matching verification sequence
Matchers:
+Function1(#13).invoke(eq(CONNECTING)))
+PlatformSocket(#14).openSocket(any()))
+Function1(#13).invoke(eq(CONNECTED)))
PlatformSocket(#14).sendMessage(eq({"token":"1234567890","id":"id","guestInformation":{"email":"<mailto:peter.parker@marvel.com|peter.parker@marvel.com>","phoneNumber":"911","firstName":"Peter","lastName":"Parker"},"action":"configureSession"})))
Calls:
1) +Function1(#13).invoke(CONNECTING)
2) +PlatformSocket(#14).openSocket()
3) +Function1(#13).invoke(CONNECTED)
4) PlatformSocket(#14).sendMessage({"token":"1234567890","id":"id","guestInformation":{"email":"<mailto:peter.parker@marvel.com|peter.parker@marvel.com>","phoneNumber":"911","firstName":"Peter","lastName":"Parker"},"action":"getAttachment"})
Stack traces:
1) io.mockk.impl.InternalPlatform.captureStackTrace (InternalPlatform.kt:121)
In this case the difference was with action
key.
it was expected to be configureSession
but was getAttachment
.
It will be helpful to get the argument matcher exception with details what did not matchMattia Tommasone
05/07/2021, 3:17 PM