我正在尝试使用 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 的新手,可能是什么问题?