FutureConcept

trait FutureConcept[T]

Concept trait for futures, instances of which are passed to the whenReady methods of trait Futures.

See the documentation for trait Futures for the details on the syntax this trait provides for testing with futures.

class Object
trait Matchable
class Any

Value members

Abstract methods

def eitherValue: Option[Either[Throwable, T]]

Queries this future for its value.

Queries this future for its value.

If the future is not ready, this method will return None. If ready, it will either return an exception or a T.

def isCanceled: Boolean

Indicates whether this future has been canceled.

Indicates whether this future has been canceled.

If the underlying future does not support the concept of cancellation, this method must always return false.

def isExpired: Boolean

Indicates whether this future has expired (timed out).

Indicates whether this future has expired (timed out).

The timeout detected by this method is different from the timeout supported by whenReady. This timeout is a timeout of the underlying future. If the underlying future does not support timeouts, this method must always return false.

Concrete methods

final def futureValue(timeout: Timeout, interval: Interval)(implicit pos: Position): T

Returns the result of this FutureConcept, once it is ready, or throws either the exception returned by the future (i.e., value returned a Left) or TestFailedException.

Returns the result of this FutureConcept, once it is ready, or throws either the exception returned by the future (i.e., value returned a Left) or TestFailedException.

The maximum amount of time to wait for the future to become ready before giving up and throwing TestFailedException is configured by the value contained in the passed timeout parameter. The interval to sleep between queries of the future (used only if the future is polled) is configured by the value contained in the passed interval parameter.

This method invokes the overloaded futureValue form with only one (implicit) argument list that contains only one argument, a PatienceConfig, passing a new PatienceConfig with the Timeout specified as timeout and the Interval specified as interval.

If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.

Value parameters:
interval

the Interval configuration parameter

timeout

the Timeout configuration parameter

Returns:

the result of the future once it is ready, if value is defined as a Right

Throws:
TestFailedException

if the future is cancelled, expires, or is still not ready after the specified timeout has been exceeded

Throwable

if once ready, the value of this future is defined as a Left (in this case, this method throws that same exception)

final def futureValue(timeout: Timeout)(implicit config: PatienceConfig, pos: Position): T

Returns the result of this FutureConcept, once it is ready, or throws either the exception returned by the future (i.e., value returned a Left) or TestFailedException.

Returns the result of this FutureConcept, once it is ready, or throws either the exception returned by the future (i.e., value returned a Left) or TestFailedException.

The maximum amount of time to wait for the future to become ready before giving up and throwing TestFailedException is configured by the value contained in the passed timeout parameter. The interval to sleep between queries of the future (used only if the future is polled) is configured by the interval field of the PatienceConfig passed implicitly as the last parameter.

This method invokes the overloaded futureValue form with only one (implicit) argument list that contains only one argument, a PatienceConfig, passing a new PatienceConfig with the Timeout specified as timeout and the Interval specified as config.interval.

If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.

Value parameters:
config

an PatienceConfig object containing timeout and interval parameters that are unused by this method

timeout

the Timeout configuration parameter

Returns:

the result of the future once it is ready, if eitherValue is defined as a Right

Throws:
TestFailedException

if the future is cancelled, expires, or is still not ready after the specified timeout has been exceeded

Throwable

if once ready, the eitherValue of this future is defined as a Left (in this case, this method throws that same exception)

final def futureValue(interval: Interval)(implicit config: PatienceConfig, pos: Position): T

Returns the result of this FutureConcept, once it is ready, or throws either the exception returned by the future (i.e., eitherValue returned a Left) or TestFailedException.

Returns the result of this FutureConcept, once it is ready, or throws either the exception returned by the future (i.e., eitherValue returned a Left) or TestFailedException.

The maximum amount of time to wait for the future to become ready before giving up and throwing TestFailedException is configured by the timeout field of the PatienceConfig passed implicitly as the last parameter. The interval to sleep between queries of the future (used only if the future is polled) is configured by the value contained in the passed interval parameter.

This method invokes the overloaded futureValue form with only one (implicit) argument list that contains only one argument, a PatienceConfig, passing a new PatienceConfig with the Interval specified as interval and the Timeout specified as config.timeout.

If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.

Value parameters:
config

an PatienceConfig object containing timeout and interval parameters that are unused by this method

interval

the Interval configuration parameter

Returns:

the result of the future once it is ready, if value is defined as a Right

Throws:
TestFailedException

if the future is cancelled, expires, or is still not ready after the specified timeout has been exceeded

Throwable

if once ready, the value of this future is defined as a Left (in this case, this method throws that same exception)

def futureValue(implicit config: PatienceConfig, pos: Position): T

Returns the result of this FutureConcept, once it is ready, or throws either the exception returned by the future (i.e., futureValue returned a Left) or TestFailedException.

Returns the result of this FutureConcept, once it is ready, or throws either the exception returned by the future (i.e., futureValue returned a Left) or TestFailedException.

This trait's implementation of this method queries the future repeatedly until it either is ready, or a configured maximum amount of time has passed, sleeping a configured interval between attempts; and when ready, returns the future's value. For greater efficiency, implementations of this trait may override this method so that it blocks the specified timeout while waiting for the result, if the underlying future supports this.

The maximum amount of time to wait for the future to become ready before giving up and throwing TestFailedException is configured by the timeout field of the PatienceConfig passed implicitly as the last parameter. The interval to sleep between queries of the future (used only if the future is polled) is configured by the interval field of the PatienceConfig passed implicitly as the last parameter.

If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.

Value parameters:
config

a PatienceConfig object containing timeout and interval parameters that are unused by this method

Returns:

the result of the future once it is ready, if value is defined as a Right

Throws:
TestFailedException

if the future is cancelled, expires, or is still not ready after the specified timeout has been exceeded

Throwable

if once ready, the value of this future is defined as a Left (in this case, this method throws that same exception)

final def isReadyWithin(timeout: Span)(implicit config: PatienceConfig, pos: Position): Boolean

Indicates whether this future is ready within the specified timeout.

Indicates whether this future is ready within the specified timeout.

If the eitherValue method of the underlying Scala future returns a scala.Some containing a scala.util.Failure containing a java.util.concurrent.ExecutionException, and this exception contains a non-null cause, that cause will be included in the TestFailedException as its cause. The ExecutionException will be be included as the TestFailedException's cause only if the ExecutionException's cause is null.