public final class Conditions extends Object
TimedConditions.| Modifier and Type | Class and Description |
|---|---|
static interface |
Conditions.CombinableCondition
A timed condition that may be logically combined with others, by means of basic logical operations: 'and'/'or'.
|
| Modifier and Type | Method and Description |
|---|---|
static TimedCondition |
alwaysFalse()
A timed condition that always returns
false |
static TimedCondition |
alwaysTrue()
A timed condition that always returns
true |
static Conditions.CombinableCondition |
and(Iterable<TimedQuery<Boolean>> conditions)
Return new combinable condition that is logical product of conditions.
|
static Conditions.CombinableCondition |
and(TimedQuery<Boolean>... conditions)
Return new combinable condition that is logical product of conditions.
|
static TimedCondition |
dependantCondition(TimedQuery<Boolean> original,
com.google.common.base.Supplier<TimedQuery<Boolean>> dependant)
Returns a condition that combines original and dependant in a manner that dependant condition
will only ever be retrieved if the original condition is
true. |
static <T> TimedCondition |
forMatcher(TimedQuery<T> query,
org.hamcrest.Matcher<? super T> matcher)
Return condition that will be
true, if given matcher will match the query. |
static TimedCondition |
forSupplier(long defaultTimeout,
com.google.common.base.Supplier<Boolean> supplier)
Returns a timed condition, whose current evaluation is based on a value provided by given supplier.
|
static TimedCondition |
forSupplier(com.google.common.base.Supplier<Boolean> supplier)
Returns a timed condition, whose current evaluation is based on a value provided by given supplier.
|
static TimedCondition |
forSupplier(Timeouts timeouts,
com.google.common.base.Supplier<Boolean> supplier)
Returns a timed condition, whose current evaluation is based on a value provided by the
supplier and with
a default timeout. |
static TimedCondition |
forSupplier(Timeouts timeouts,
com.google.common.base.Supplier<Boolean> supplier,
TimeoutType timeoutType)
Returns a timed condition, whose current evaluation is based on a value provided by the
supplier, with
timeout of timeoutType. |
static <T> TimedCondition |
isEqual(T value,
TimedQuery<T> query)
Returns timed condition verifying that given query will evaluate to value equal to value.
|
static TimedQuery<Boolean> |
not(TimedQuery<Boolean> condition)
Return new timed condition that is a negation of condition.
|
static Conditions.CombinableCondition |
or(Iterable<TimedQuery<Boolean>> conditions)
Return new combinable condition that is logical sum of conditions.
|
static Conditions.CombinableCondition |
or(TimedQuery<Boolean>... conditions)
Return new combinable condition that is logical sum of conditions.
|
@Nonnull public static TimedQuery<Boolean> not(@Nonnull TimedQuery<Boolean> condition)
condition - condition to be negatedTimedCondition instance.@Nonnull public static Conditions.CombinableCondition and(@Nonnull TimedQuery<Boolean>... conditions)
Return new combinable condition that is logical product of conditions.
The resulting condition will have interval of the first condition in the conditions array,
conditions - conditions to conjoinIllegalArgumentException - if conditions array is null or emptyPollingQuery.interval()@Nonnull public static Conditions.CombinableCondition and(@Nonnull Iterable<TimedQuery<Boolean>> conditions)
Return new combinable condition that is logical product of conditions.
The resulting condition will have interval of the first condition in the conditions array,
conditions - conditions to conjoinIllegalArgumentException - if conditions array is null or emptyPollingQuery.interval()@Nonnull public static Conditions.CombinableCondition or(@Nonnull TimedQuery<Boolean>... conditions)
Return new combinable condition that is logical sum of conditions.
The resulting condition will have interval of the first condition in the conditions array,
conditions - conditions to sumIllegalArgumentException - if conditions array is null or emptyPollingQuery.interval()@Nonnull public static Conditions.CombinableCondition or(@Nonnull Iterable<TimedQuery<Boolean>> conditions)
Return new combinable condition that is logical sum of conditions.
The resulting condition will have interval of the first condition in the conditions array,
conditions - conditions to sumIllegalArgumentException - if conditions array is null or emptyPollingQuery.interval()@Nonnull public static TimedCondition dependantCondition(@Nonnull TimedQuery<Boolean> original, @Nonnull com.google.common.base.Supplier<TimedQuery<Boolean>> dependant)
Returns a condition that combines original and dependant in a manner that dependant condition
will only ever be retrieved if the original condition is true. This is useful
when dependant condition may only be retrieved given the original condition is true.
The supplier for dependant condition is allowed to return null or throw exception if the
original condition returns false. But it may not do so given the original condition is true,
as this will lead to NullPointerException or the raised exception be propagated by
this condition respectively.
original - original conditiondependant - supplier for dependant condition that will only be evaluated given the original condition
evaluates to true@Nonnull public static <T> TimedCondition forMatcher(@Nonnull TimedQuery<T> query, @Nonnull org.hamcrest.Matcher<? super T> matcher)
true, if given matcher will match the query. Any
Hamcrest matcher implementation may be used.
Example:
TimedCondition textEquals = Conditions.forMatcher(element.getText(), isEqualTo("blah"));
T - type of the resultquery - timed query to matchmatcher - matcher for the query@Nonnull public static <T> TimedCondition isEqual(@Nullable T value, @Nonnull TimedQuery<T> query)
T - type of the valuevalue - value that query should be equalt toquery - the timed query@Nonnull public static TimedCondition forSupplier(@Nonnull com.google.common.base.Supplier<Boolean> supplier)
supplier - supplier of the current condition value@Nonnull public static TimedCondition forSupplier(long defaultTimeout, @Nonnull com.google.common.base.Supplier<Boolean> supplier)
defaultTimeout - default timeout of the conditionsupplier - supplier of the current condition value@Nonnull public static TimedCondition forSupplier(@Nonnull Timeouts timeouts, @Nonnull com.google.common.base.Supplier<Boolean> supplier)
supplier and with
a default timeout.timeouts - an instance of timeouts to use for the new conditionsupplier - supplier of the current condition value@Nonnull public static TimedCondition forSupplier(@Nonnull Timeouts timeouts, @Nonnull com.google.common.base.Supplier<Boolean> supplier, @Nonnull TimeoutType timeoutType)
supplier, with
timeout of timeoutType.timeouts - an instance of timeouts to use for the new conditionsupplier - supplier of the current condition valuetimeoutType - @param timeoutType timeout type for the condition@Nonnull public static TimedCondition alwaysTrue()
true@Nonnull public static TimedCondition alwaysFalse()
falseCopyright © 2015 Atlassian. All rights reserved.