From 1b1b8258657f47549d778eaf8707428e90d93d0c Mon Sep 17 00:00:00 2001 From: Richard Imaoka Date: Tue, 27 Jun 2017 18:45:37 +0900 Subject: [PATCH] =tes Add parameter scaladocs to expectTerminated (#23227) * Add API parameter comments to expectTerminated (Fixes #23091) * Clarify that expectTerminated requires watch(target) beforehand --- akka-testkit/src/main/scala/akka/testkit/TestKit.scala | 3 +++ .../src/main/scala/akka/testkit/javadsl/TestKit.scala | 9 +++++++++ 2 files changed, 12 insertions(+) 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)