0
Я получаюExpectMsg ошибка с AkkaTest
Несоответствие типа: ожидаемый 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")
}
}
}
Похоже, я использовал неправильную тестовую версию scala. Я использовал 3.0.0. Изменилось его 2.2.5. –