私は akka と kotlin で遊んでいます。akka Java API を使用しています。Actor クラスは問題なく動作します。しかし、Akka-testkit でテストケースを実装することはできません。
これは私のテストケースです。
fun testWordCount() {
object : JavaTestKit(system) {
init {
val masterActor = system.actorOf(Props.create(WordCountActor.WordCountMaster::class.java), "master")
masterActor.tell(WordCountActor.StartCounting("src/main/resources/", 5), testActor)
val wcs = expectMsgClass(JavaTestKit.duration("5 seconds"), WordCountActor.WordCountSuccess::class.java)
object : JavaTestKit.Within(JavaTestKit.duration("5 seconds")) {
override fun run() {
Assert.assertEquals(20, wcs.result.size)
}
}
}
}
}
以下のエラーが表示されます -
Error:(39, 17) Kotlin: [Internal Error] org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Error generating constructors of class null with kind IMPLEMENTATION
Cause: Error generating constructors of class null with kind IMPLEMENTATION
File being compiled and position: (39,17) in /Users/kunalkanojia/Workspace/fun/kotlin_word_count/src/test/kotlin/WordCountActorTest.kt
PsiElement: object : JavaTestKit.Within(JavaTestKit.duration("20 seconds")) {
override fun run() {
Assert.assertEquals(20, wcs.result.size.toLong())
}
}
私は Kotlin を初めて使用しますが、何が問題なのですか?