From 0c76ad9d4dfdcdbcc392b6285df733e9de219753 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Sat, 24 Aug 2024 03:25:58 +0800 Subject: [PATCH] simpler test --- .../pekko/actor/typed/BehaviorSpec.scala | 40 ++++++------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/BehaviorSpec.scala b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/BehaviorSpec.scala index a2b9d22b74..47acbd0cd0 100644 --- a/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/BehaviorSpec.scala +++ b/actor-typed-tests/src/test/scala/org/apache/pekko/actor/typed/BehaviorSpec.scala @@ -379,34 +379,18 @@ class ReceiveBehaviorSpec extends Messages with BecomeWithLifecycle with Stoppab } class ReceiveMessageWithSameBehaviorSpec extends Messages { - override def behavior(monitor: ActorRef[Event]): (Behavior[Command], Aux) = behv(monitor, StateA) -> null - private def behv(monitor: ActorRef[Event], state: State): Behavior[Command] = { - SBehaviors.setup[Command] { context => - SBehaviors - .receiveMessageWithSame[Command] { - case GetSelf => - monitor ! Self(context.self) - case Miss => - monitor ! Missed - case Ignore => - monitor ! Ignored - case Ping => - monitor ! Pong - behv(monitor, state) - case Swap => - monitor ! Swapped - behv(monitor, state.next) - case GetState() => - monitor ! state - case Stop => SBehaviors.stopped - case _: AuxPing => SBehaviors.unhandled - } - .receiveSignal { - case (_, signal) => - monitor ! ReceivedSignal(signal) - SBehaviors.same - } - } + override def behavior(monitor: ActorRef[Event]): (Behavior[Command], Aux) = behv(monitor) -> null + private def behv(monitor: ActorRef[Event]): Behavior[Command] = { + SBehaviors + .receiveMessageWithSame[Command] { + case Miss => + monitor ! Missed + case Ignore => + monitor ! Ignored + case Ping => + monitor ! Pong + case _ => + } } }