Skip to content

Commit

Permalink
Align Moshi "null" test with other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joffrey-bion committed Jun 10, 2022
1 parent c13b69e commit 3b8c11b
Showing 1 changed file with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeout
import org.hildan.krossbow.stomp.conversions.*
import org.hildan.krossbow.stomp.frame.FrameBody
import org.hildan.krossbow.stomp.frame.StompFrame
Expand Down Expand Up @@ -91,21 +90,17 @@ class MoshiConverterTest {
}

@Test
fun subscribe_failsOnNullBody() {
runBlocking {
withTimeout(1000) {
val session = MockStompSession()
val jsonSession = session.withMoshi()

val messages = jsonSession.subscribe<Int>("/test")
launch {
session.simulateSubscriptionFrame(null)
}

assertFailsWith(EOFException::class) {
messages.first()
}
}
fun subscribe_failsOnNullBody(): Unit = runBlocking {
val session = MockStompSession()
val jsonSession = session.withMoshi()

val messages = jsonSession.subscribe<Int>("/test")
launch {
session.simulateSubscriptionFrame(null)
}

assertFailsWith(EOFException::class) {
messages.first()
}
}
}

0 comments on commit 3b8c11b

Please sign in to comment.