2016-08-15 9 views
1

私はakkaとkotlinで遊んでいます。私はakka java APIを使用しています。 Actorクラスは正常に動作します。しかし、Akka-testkitでテストケースを実装することはできません。kotlinとakka-testkitでakkaアクターをテストする

これは、私は以下のエラーを取得し、

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に新しいですか?

+0

Scala/Javaでコードをどのように見えるのですか? – voddan

+0

あなたはどのバージョンのKotlinを使用していますか?次のコード([pastebin](http://pastebin.com/kxSD8ZBY))は、Kotlinコンパイラバージョン1.1.0-dev-2222 – soon

+0

Am 1.0.3を使用してうまくコンパイルします。コードはうまくコンパイルされますが、実行するとエラーが発生します。そして、javaのように見えます - https://gist.github.com/kunalkanojia/8202d0690208949054eee8b88cec8da2 –

答えて

2

これはkotlinコンパイラのバグで、1.0.4ブランチで修正されました。スナップショットのバージョンで使用可能です。 kotlin 1.0.3の場合は回避策を使用できますhttps://youtrack.jetbrains.com/issue/KT-11833

関連する問題