clarify docs of ActorTestKit.stop, #24165
This commit is contained in:
parent
5621899bb6
commit
5f409c17e0
3 changed files with 8 additions and 0 deletions
|
|
@ -153,10 +153,14 @@ final class ActorTestKit private[akka] (delegate: akka.actor.testkit.typed.scala
|
|||
def spawn[T](behavior: Behavior[T], name: String, props: Props): ActorRef[T] = delegate.spawn(behavior, name, props)
|
||||
/**
|
||||
* Stop the actor under test and wait until it terminates.
|
||||
* It can only be used for actors that were spawned by this `ActorTestKit`.
|
||||
* Other actors will not be stopped by this method.
|
||||
*/
|
||||
def stop[T](ref: ActorRef[T]): Unit = delegate.stop(ref)
|
||||
/**
|
||||
* Stop the actor under test and wait `max` until it terminates.
|
||||
* It can only be used for actors that were spawned by this `ActorTestKit`.
|
||||
* Other actors will not be stopped by this method.
|
||||
*/
|
||||
def stop[T](ref: ActorRef[T], max: Duration): Unit = delegate.stop(ref, max.asScala)
|
||||
|
||||
|
|
|
|||
|
|
@ -177,6 +177,8 @@ final class ActorTestKit private[akka] (val name: String, val config: Config, se
|
|||
|
||||
/**
|
||||
* Stop the actor under test and wait until it terminates.
|
||||
* It can only be used for actors that were spawned by this `ActorTestKit`.
|
||||
* Other actors will not be stopped by this method.
|
||||
*/
|
||||
def stop[T](ref: ActorRef[T], max: FiniteDuration = timeout.duration): Unit = try {
|
||||
Await.result(internalSystem ? { x: ActorRef[ActorTestKitGuardian.Ack.type] ⇒ ActorTestKitGuardian.StopActor(ref, x) }, max)
|
||||
|
|
|
|||
|
|
@ -211,6 +211,8 @@ Scala
|
|||
Java
|
||||
: @@snip [AsyncTestingExampleTest.java](/akka-actor-testkit-typed/src/test/java/jdocs/akka/actor/testkit/typed/javadsl/AsyncTestingExampleTest.java) { #test-stop-actors }
|
||||
|
||||
The `stop` method can only be used for actors that were spawned by the same `ActorTestKit`. Other actors
|
||||
will not be stopped by that method.
|
||||
|
||||
### Test framework integration
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue