Last active
December 30, 2015 23:39
-
-
Save archie/7901805 to your computer and use it in GitHub Desktop.
This does not compile since ImplicitSender depends on TestKit and not TestKitBase. Error message: "illegal inheritance; self-type demo.EchoSpec does not conform to akka.testkit.ImplicitSender's selftype akka.testkit.ImplicitSender with akka.testkit.TestKit [---] line 18"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo | |
import org.scalatest._ | |
import akka.testkit.TestKit | |
import akka.actor.Actor | |
import akka.actor.ActorSystem | |
import akka.testkit.TestKitBase | |
import akka.testkit.ImplicitSender | |
import akka.actor.Props | |
class Echo extends Actor { | |
def receive = { | |
case msg => sender ! msg | |
} | |
} | |
class EchoSpec extends FlatSpec with Matchers | |
with TestKitBase with BeforeAndAfterAll with ImplicitSender { // this does not compile with Akka 2.2.3 | |
implicit lazy val system = ActorSystem() | |
override def afterAll = system.shutdown | |
"An actor" should "echo a message" in { | |
val echoActor = system.actorOf(Props[Echo], "echo") | |
echoActor ! "hello there" | |
expectMsg("hello there") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment