Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoferrer committed Aug 22, 2019
1 parent 19c0ce4 commit 9bfb977
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
Expand Up @@ -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" }
}
Expand Down
Expand Up @@ -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" }
Expand Down
Expand Up @@ -302,7 +302,7 @@ class ServerCallClientStreamingTests {
// We wait for the server scope to complete before proceeding with assertions
serverCtx[Job]!!.join()

verify(exactly = 1) { responseObserver.onError(matchStatus(Status.CANCELLED, "CANCELLED: test")) }
verify(exactly = 1) { responseObserver.onError(matchStatus(Status.CANCELLED)) }

assert(serverCtx[Job]!!.isCompleted) { "Server job should be completed" }
assert(serverCtx[Job]!!.isCancelled) { "Server job should be cancelled" }
Expand Down
Expand Up @@ -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)
}

Expand Down

0 comments on commit 9bfb977

Please sign in to comment.