diff --git a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala index 946addd112..4d44e6505f 100644 --- a/akka-testkit/src/main/scala/akka/testkit/TestKit.scala +++ b/akka-testkit/src/main/scala/akka/testkit/TestKit.scala @@ -408,8 +408,11 @@ trait TestKitBase { /** * Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef. + * Before calling this method, you have to `watch` the target actor ref. * Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout. * + * @param target the actor ref expected to be Terminated + * @param max wait no more than max time, otherwise throw AssertionFailure * @return the received Terminated message */ def expectTerminated(target: ActorRef, max: Duration = Duration.Undefined): Terminated = diff --git a/akka-testkit/src/main/scala/akka/testkit/javadsl/TestKit.scala b/akka-testkit/src/main/scala/akka/testkit/javadsl/TestKit.scala index 477b641b82..050af8d563 100644 --- a/akka-testkit/src/main/scala/akka/testkit/javadsl/TestKit.scala +++ b/akka-testkit/src/main/scala/akka/testkit/javadsl/TestKit.scala @@ -334,13 +334,22 @@ class TestKit(system: ActorSystem) { /** * Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef. + * Before calling this method, you have to `watch` the target actor ref. * Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout. + * + * @param max wait no more than max time, otherwise throw AssertionFailure + * @param target the actor ref expected to be Terminated + * @return the received Terminated message */ def expectTerminated(max: Duration, target: ActorRef): Terminated = tp.expectTerminated(target, max) /** * Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef. + * Before calling this method, you have to `watch` the target actor ref. * Wait time is bounded by the given duration, with an AssertionFailure being thrown in case of timeout. + * + * @param target the actor ref expected to be Terminated + * @return the received Terminated message */ def expectTerminated(target: ActorRef): Terminated = tp.expectTerminated(target)