From 144649a4570cffdc6426e20073002dae9b9fd5e5 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Wed, 17 Nov 2021 16:45:43 +0100 Subject: Upgrade to Kotlin 1.6.0 and JDK 17 --- .../org/luxons/sevenwonders/server/test/ClientEventsAsserts.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sw-server/src/test/kotlin/org') diff --git a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/test/ClientEventsAsserts.kt b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/test/ClientEventsAsserts.kt index 65711d6d..62245764 100644 --- a/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/test/ClientEventsAsserts.kt +++ b/sw-server/src/test/kotlin/org/luxons/sevenwonders/server/test/ClientEventsAsserts.kt @@ -12,8 +12,8 @@ import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue import kotlin.time.Duration -import kotlin.time.milliseconds -import kotlin.time.seconds +import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Duration.Companion.seconds class EventAsserter( val gameListEvents: ReceiveChannel, @@ -27,20 +27,20 @@ suspend fun SevenWondersSession.eventAsserter(scope: CoroutineScope): EventAsser return EventAsserter(gameListEvents, gameEvents) } -suspend inline fun EventAsserter.expectNoGameEvent(message: String? = null, timeout: Duration = Duration.milliseconds(50)) { +suspend inline fun EventAsserter.expectNoGameEvent(message: String? = null, timeout: Duration = 50.milliseconds) { val event = withTimeoutOrNull(timeout) { gameEvents.receive() } val extraMessage = message?.let { " ($it)" } ?: "" assertNull(event, "Expected no game event$extraMessage, but received $event") } -suspend inline fun EventAsserter.expectGameEvent(timeout: Duration = Duration.seconds(1)): T { +suspend inline fun EventAsserter.expectGameEvent(timeout: Duration = 1.seconds): T { val event = withTimeoutOrNull(timeout) { gameEvents.receive() } assertNotNull(event, "Expected event of type ${T::class.simpleName}, received nothing in $timeout") assertTrue(event is T, "Expected event of type ${T::class.simpleName}, received $event") return event } -suspend inline fun EventAsserter.expectGameListEvent(timeout: Duration = Duration.seconds(1)): T { +suspend inline fun EventAsserter.expectGameListEvent(timeout: Duration = 1.seconds): T { val event = withTimeoutOrNull(timeout) { gameListEvents.receive() } assertNotNull(event, "Expected event of type ${T::class.simpleName}, received nothing in $timeout") assertTrue(event is T, "Expected event of type ${T::class.simpleName}, received $event") -- cgit