我有以下的測試案例:阿卡演員Testkit
class MutableStateActorTest extends TestKit(ActorSystem("MutableStateActorTest")) with WordSpecLike with Matchers {
"A MutableStateActor" must {
val actRef = TestActorRef[MutableStateActor]
"mutate state in order" in {
1 to 5 foreach {
x => actRef ! Increment
}
}
}
}
它不能簡單說是,但我得到以下錯誤,當我試圖運行它:
An exception or error caused a run to abort: Found class akka.actor.ActorPath, but interface was expected
java.lang.IncompatibleClassChangeError: Found class akka.actor.ActorPath, but interface was expected
at akka.testkit.TestActorRef.<init>(TestActorRef.scala:47)
at akka.testkit.TestActorRef$.apply(TestActorRef.scala:141)
at akka.testkit.TestActorRef$.apply(TestActorRef.scala:137)
at akka.testkit.TestActorRef$.apply(TestActorRef.scala:146)
at akka.testkit.TestActorRef$.apply(TestActorRef.scala:144)
at q31.sandbox.statetest.MutableStateActorTest$$anonfun$1.apply$mcV$sp(MutableStateActorTest.scala:16)
at q31.sandbox.statetest.MutableStateActorTest$$anonfun$1.apply(MutableStateActorTest.scala:14)
at q31.sandbox.statetest.MutableStateActorTest$$anonfun$1.apply(MutableStateActorTest.scala:14)
我猜猜它與Actor參考有關?
您運行的是什麼版本的阿卡和你可能有多個版本阿卡對你r classpath? – cmbaxter