0

我正进入(状态

类型不匹配:预期 ReaperSpec.this.Register,实际:String

expectMsg(...)将 AkkaTest 与此处指定的 ScalaTest 一起使用时在哪里( http://doc.akka.io/docs/akka/snapshot/scala/testing.html

我错过了什么?

import akka.actor.{ActorSystem, Props}
import akka.testkit.{TestKit, TestProbe}
import system.Reaper.WatchMe
import org.scalatest.{BeforeAndAfterAll, MustMatchers, WordSpecLike}

class ReaperSpec(_system: ActorSystem) extends TestKit(_system)
with WordSpecLike with MustMatchers with BeforeAndAfterAll {

  def this() = this(ActorSystem("Reaper"))

  override protected def afterAll(): Unit = TestKit.shutdownActorSystem(system)

  "A reaper" must {
    "terminated when all child actors are stopped" in {
      val probeA = TestProbe()
      val probeB = TestProbe()

      val reaper = system.actorOf(Props(classOf[Reaper]))

      reaper ! WatchMe(probeA.ref)
      reaper ! WatchMe(probeB.ref)

      system.stop(probeA.ref)
      system.stop(probeB.ref)

      expectMsg("Dead")
    }
  }
}
4

1 回答 1

0

好像我使用了错误的 scala 测试版本。我使用的是 3.0.0-M9。将其更改为 2.2.5 有效。

于 2015-09-20T11:09:19.097 回答