diff --git a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala index b466b8a9d8..4f6744b74b 100644 --- a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala +++ b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala @@ -16,7 +16,7 @@ import scala.annotation.varargs import scala.reflect.ClassTag object TestActor { - type Ignore = Option[PartialFunction[AnyRef, Boolean]] + type Ignore = Option[PartialFunction[Any, Boolean]] abstract class AutoPilot { def run(sender: ActorRef, msg: Any): AutoPilot @@ -138,7 +138,7 @@ trait TestKitBase { * Ignore all messages in the test actor for which the given partial * function returns true. */ - def ignoreMsg(f: PartialFunction[AnyRef, Boolean]) { testActor ! TestActor.SetIgnore(Some(f)) } + def ignoreMsg(f: PartialFunction[Any, Boolean]) { testActor ! TestActor.SetIgnore(Some(f)) } /** * Stop ignoring messages in the test actor. diff --git a/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala b/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala index a413aa86a9..72e5b3a8c0 100644 --- a/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/TestProbeSpec.scala @@ -78,6 +78,13 @@ class TestProbeSpec extends AkkaSpec with DefaultTimeout { expectMsgAllClassOf(5 seconds, classOf[Int]) must be(Seq(42)) } + "be able to ignore primitive types" in { + ignoreMsg { case 42 ⇒ true } + testActor ! 42 + testActor ! "pigdog" + expectMsg("pigdog") + } + } }