Browse Source

Fix test KeepAliveNetworkHandlerSelectorTest

Him188 4 years ago
parent
commit
0e1b9da5e4

+ 1 - 0
mirai-core/build.gradle.kts

@@ -96,6 +96,7 @@ kotlin {
                     implementation(kotlin("test-junit5", Versions.kotlinCompiler))
                     implementation(kotlin("test-annotations-common"))
                     implementation(kotlin("test-common"))
+                    implementation("org.bouncycastle:bcprov-jdk15on:1.64")
                 }
             }
         }

+ 2 - 2
mirai-core/src/commonTest/kotlin/network/handler/AbstractKeepAliveNetworkHandlerSelectorTest.kt

@@ -31,7 +31,7 @@ internal class KeepAliveNetworkHandlerSelectorTest {
 
     @Test
     fun `can initialize instance`() {
-        val selector = TestSelector { createHandler() }
+        val selector = TestSelector { createHandler().apply { setState(State.OK) } }
         runBlockingUnit(timeout = 3.seconds) { selector.awaitResumeInstance() }
         assertNotNull(selector.getResumedInstance())
     }
@@ -49,7 +49,7 @@ internal class KeepAliveNetworkHandlerSelectorTest {
     @Test
     fun `initialize another when closed`() {
         val selector = TestSelector {
-            createHandler()
+            createHandler().apply { setState(State.OK) }
         }
         val handler = createHandler()
         selector.setCurrent(handler)