=tes Add parameter scaladocs to expectTerminated (#23227)

* Add API parameter comments to expectTerminated (Fixes #23091)

* Clarify that expectTerminated requires watch(target) beforehand
This commit is contained in:
Richard Imaoka 2017-06-27 18:45:37 +09:00 committed by Konrad `ktoso` Malawski
parent 403702d19f
commit 1b1b825865
2 changed files with 12 additions and 0 deletions

View file

@ -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. * 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. * 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 * @return the received Terminated message
*/ */
def expectTerminated(target: ActorRef, max: Duration = Duration.Undefined): Terminated = def expectTerminated(target: ActorRef, max: Duration = Duration.Undefined): Terminated =

View file

@ -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. * 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. * 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) 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. * 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. * 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) def expectTerminated(target: ActorRef): Terminated = tp.expectTerminated(target)