object Test {
def main(args: Array[String]): Unit = {
def child(s: String): Behavior[String] =
Behaviors.immutable {
case (_, `s`) => Behaviors.same
case (_, _) => Behaviors.stopped
}
sealed trait Command
val parent: Behavior[Command] =
Behaviors.setup { context =>
context.spawn(child("foo"), "child")
Behaviors.empty
}
val testKit = BehaviorTestKit(parent)
testKit.expectEffect(Effects.Spawned(child("foo"), "child"))
}
}
this leads to
Exception in thread "main" java.lang.AssertionError: assertion failed: expected: Spawned(Immutable(MainTests.scala:34-36),child,EmptyProps) but found Spawned(Immutable(MainTests.scala:34-36),child,EmptyProps)
So it seems that the two behaviors are compared using equals
and this doesn’t work.