diff --git a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala index cbc4331834..350c3c3762 100644 --- a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala +++ b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala @@ -86,7 +86,7 @@ class TestActor(queue: BlockingDeque[TestActor.Message]) extends Actor with FSM[ * @author Roland Kuhn * @since 1.1 */ -class TestKit(_app: AkkaApplication = AkkaApplication()) { +class TestKit(_app: AkkaApplication) { import TestActor.{ Message, RealMessage, NullMessage } @@ -101,14 +101,7 @@ class TestKit(_app: AkkaApplication = AkkaApplication()) { * ActorRef of the test actor. Access is provided to enable e.g. * registration as message target. */ - val testActor = new LocalActorRef(application, Props(new TestActor(queue)).copy(dispatcher = CallingThreadDispatcher.global), "testActor" + TestKit.testActorId.incrementAndGet(), true) - - /** - * Implicit sender reference so that replies are possible for messages sent - * from the test class. - */ - @deprecated("will be removed after 1.2, replaced by implicit testActor", "1.2") - val senderOption = Some(testActor) + implicit val testActor: ActorRef = new LocalActorRef(application, Props(new TestActor(queue)).copy(dispatcher = CallingThreadDispatcher.global), "testActor" + TestKit.testActorId.incrementAndGet(), true) private var end: Duration = Duration.Inf diff --git a/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala b/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala new file mode 100644 index 0000000000..88a45d11b7 --- /dev/null +++ b/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala @@ -0,0 +1,13 @@ +/** + * Copyright (C) 2009-2011 Typesafe Inc. + */ +package akka.testkit + +import org.scalatest.WordSpec +import org.scalatest.matchers.MustMatchers +import akka.AkkaApplication + +abstract class AkkaSpec(_application: AkkaApplication = AkkaApplication()) + extends TestKit(_application) with WordSpec with MustMatchers { + +} \ No newline at end of file diff --git a/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala index 4ca291c50d..023b72425c 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestActorRefSpec.scala @@ -90,7 +90,7 @@ object TestActorRefSpec { } -class TestActorRefSpec extends TestKit with WordSpec with MustMatchers with BeforeAndAfterEach { +class TestActorRefSpec extends AkkaSpec with BeforeAndAfterEach { import TestActorRefSpec._ diff --git a/akka-testkit/src/test/scala/akka/testkit/TestFSMRefSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestFSMRefSpec.scala index 997e5c25ba..0184dc42eb 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestFSMRefSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestFSMRefSpec.scala @@ -9,7 +9,7 @@ import org.scalatest.{ BeforeAndAfterEach, WordSpec } import akka.actor._ import akka.util.duration._ -class TestFSMRefSpec extends TestKit with WordSpec with MustMatchers { +class TestFSMRefSpec extends AkkaSpec { import FSM._ diff --git a/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala index 68ad448c4e..6da2bf6439 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala @@ -8,7 +8,7 @@ import akka.event.EventHandler import akka.dispatch.Future import akka.util.duration._ -class TestProbeSpec extends TestKit with WordSpec with MustMatchers { +class TestProbeSpec extends AkkaSpec { "A TestProbe" must { diff --git a/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala index e61d4e7de1..daf89cac4b 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestTimeSpec.scala @@ -4,7 +4,7 @@ import org.scalatest.matchers.MustMatchers import org.scalatest.{ BeforeAndAfterEach, WordSpec } import akka.util.Duration -class TestTimeSpec extends TestKit with WordSpec with MustMatchers with BeforeAndAfterEach { +class TestTimeSpec extends AkkaSpec with BeforeAndAfterEach { val tf = Duration.timeFactor