首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ExpectMsg误差与AkkaTest

ExpectMsg误差与AkkaTest
EN

Stack Overflow用户
提问于 2015-09-20 10:47:52
回答 1查看 102关注 0票数 0

我得到了

类型不匹配:预期的ReaperSpec.this.Register,实际:字符串

expectMsg(...)在使用AkkaTest与此处指定的ScalaTest (http://doc.akka.io/docs/akka/snapshot/scala/testing.html)时所处的位置

我遗漏了什么?

代码语言:javascript
复制
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")
    }
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-20 11:09:19

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32678460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档