From fbb77bd84cb60d64d8662831d4b7a136990fe150 Mon Sep 17 00:00:00 2001 From: Marco Ferrer <35935108+marcoferrer@users.noreply.github.com> Date: Wed, 21 Aug 2019 21:57:42 -0400 Subject: [PATCH] update tests --- .../krotoplus/coroutines/integration/BidiStreamingTests.kt | 2 +- .../krotoplus/coroutines/server/ServerCallBidiStreamingTests.kt | 2 +- .../krotoplus/coroutines/server/ServerCallUnaryTests.kt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/integration/BidiStreamingTests.kt b/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/integration/BidiStreamingTests.kt index 289665f..01f127e 100644 --- a/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/integration/BidiStreamingTests.kt +++ b/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/integration/BidiStreamingTests.kt @@ -119,7 +119,7 @@ class BidiStreamingTests { val reqChanSpy = spyk(requestChannel) launch(Dispatchers.Default, start = CoroutineStart.UNDISPATCHED) { - assertFailsWithStatus(Status.CANCELLED, "CANCELLED: Call has been cancelled") { + assertFailsWithStatus(Status.CANCELLED) { repeat(6) { reqChanSpy.send { name = "name $it" } } diff --git a/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/server/ServerCallBidiStreamingTests.kt b/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/server/ServerCallBidiStreamingTests.kt index b557a02..cf9666b 100644 --- a/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/server/ServerCallBidiStreamingTests.kt +++ b/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/server/ServerCallBidiStreamingTests.kt @@ -452,7 +452,7 @@ class ServerCallBidiStreamingTests { val respChannel = deferredRespChannel.await() assert(respChannel.isClosedForSend){ "Abandoned response channel should be closed" } - verify(exactly = 1) { responseObserver.onError(matchStatus(Status.CANCELLED, "CANCELLED: test")) } + verify(exactly = 1) { responseObserver.onError(matchStatus(Status.CANCELLED)) } coVerify(exactly = 0) { respChannel.send(any()) } assert(serverCtx[Job]!!.isCompleted){ "Server job should be completed" } assert(serverCtx[Job]!!.isCancelled){ "Server job should be cancelled" } diff --git a/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/server/ServerCallUnaryTests.kt b/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/server/ServerCallUnaryTests.kt index 2b3c9ff..fa08f69 100644 --- a/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/server/ServerCallUnaryTests.kt +++ b/kroto-plus-coroutines/src/test/kotlin/com/github/marcoferrer/krotoplus/coroutines/server/ServerCallUnaryTests.kt @@ -160,6 +160,7 @@ class ServerCallUnaryTests { verify(exactly = 1) { responseObserver.onError(matchStatus(Status.CANCELLED)) } + runBlocking { serverSpy.job?.join() } assertEquals("Job was cancelled",serverSpy.error?.message) }