Executes the passed function, enforcing the passed time limit by attempting to interrupt the function if the
time limit is exceeded, and throwing TestCanceledException
if the time limit has been
exceeded after the function completes.
Executes the passed function, enforcing the passed time limit by attempting to interrupt the function if the
time limit is exceeded, and throwing TestCanceledException
if the time limit has been
exceeded after the function completes.
If the function completes before the timeout expires:
If the function completes after the timeout expires:
TestCanceledException
.TestCanceledException
that includes the exception thrown by the function as its cause.If the interrupted status of the main test thread (the thread that invoked cancelAfter
) was not invoked
when cancelAfter
was invoked, but is set after the operation times out, it is reset by this method before
it completes abruptly with a TestCanceledException
. The interrupted status will be set by
ThreadSignaler
, the default Signaler
implementation.
the maximimum amount of time allowed for the passed operation
a strategy for interrupting the passed operation
Executes the passed function, enforcing the passed time limit by attempting to interrupt the function if the
time limit is exceeded, and throwing TestFailedDueToTimeoutException
if the time limit has been
exceeded after the function completes.
Executes the passed function, enforcing the passed time limit by attempting to interrupt the function if the
time limit is exceeded, and throwing TestFailedDueToTimeoutException
if the time limit has been
exceeded after the function completes.
If the function completes before the timeout expires:
If the function completes after the timeout expires:
TestFailedDueToTimeoutException
.TestFailedDueToTimeoutException
that includes the exception thrown by the function as its cause.If the interrupted status of the main test thread (the thread that invoked failAfter
) was not invoked
when failAfter
was invoked, but is set after the operation times out, it is reset by this method before
it completes abruptly with a TestFailedDueToTimeoutException
. The interrupted status will be set by
ThreadSignaler
, the default Signaler
implementation.
the maximimum amount of time allowed for the passed operation
the operation on which to enforce the passed timeout
a strategy for interrupting the passed operation
Companion object that facilitates the importing of
Timeouts
members as an alternative to mixing in the trait. One use case is to importTimeouts
's members so you can use them in the Scala interpreter.