Akka-typed-testkit: Provides a way of stopping actors #24165

* Added ActorTestKit#stop method and corresponding tests.
* Added 'Stopping actors' section to the docs
* Stop actor now waits until the actor terminates.
This commit is contained in:
Michael Kholodov 2018-12-21 05:37:34 -05:00 committed by Johan Andrén
parent 6d6ac21f30
commit 220021b87f
6 changed files with 87 additions and 2 deletions

View file

@ -202,6 +202,16 @@ Java
Note that you can add `import testKit._` to get access to the `spawn` and `createTestProbe` methods at the top level
without prefixing them with `testKit`.
#### Stopping actors
The method will wait until the actor stops or throw an assertion error in case of a timeout.
Scala
: @@snip [AsyncTestingExampleSpec.scala](/akka-actor-testkit-typed/src/test/scala/docs/akka/actor/testkit/typed/scaladsl/AsyncTestingExampleSpec.scala) { #test-stop-actors }
Java
: @@snip [AsyncTestingExampleTest.java](/akka-actor-testkit-typed/src/test/java/jdocs/akka/actor/testkit/typed/javadsl/AsyncTestingExampleTest.java) { #test-stop-actors }
### Test framework integration
@@@ div { .group-java }