I am trying to play around with akka and kotlin. I am using the akka java API. The Actor class works fine. But am unable to implement the testcase with Akka-testkit.
This is my testcase,
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)
}
}
}
}
}
I get the below error -
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())
}
}
I am new to Kotlin, what could be the problem?
It's a bug in kotlin compiler and it was fixed in 1.0.4 branch, fix avaliable within snapshot versions. For kotlin 1.0.3 you can use workaround from https://youtrack.jetbrains.com/issue/KT-11833
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments