Skip to content

Instantly share code, notes, and snippets.

@archie
Last active December 30, 2015 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save archie/7901805 to your computer and use it in GitHub Desktop.
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"
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