com.atlassian.jira.webtest.framework.core.condition
Class Conditions

java.lang.Object
  extended by com.atlassian.jira.webtest.framework.core.condition.Conditions

public final class Conditions
extends Object

Utilities to create miscellaneous TimedConditions.

Since:
v4.2

Nested Class Summary
static interface Conditions.CombinableCondition
          A timed condition that may be logically combined with others, by means of basic logical operations: 'and'/'or'.
 
Method Summary
static Conditions.CombinableCondition and(List<TimedCondition> conditions)
           Return new combinable condition that is logical product of conditions.
static Conditions.CombinableCondition and(TimedCondition... conditions)
           Return new combinable condition that is logical product of conditions.
static TimedCondition dependantCondition(TimedCondition original, Supplier<TimedCondition> 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 TimedCondition falseCondition()
          Condition that always returns false, with default timeout of 100ms.
static TimedCondition falseCondition(long defaultTimeout)
          Condition that always returns false.
static TimedCondition not(TimedCondition condition)
          Return new timed condition that is a negation of condition.
static Conditions.CombinableCondition or(List<TimedCondition> conditions)
           Return new combinable condition that is logical sum of conditions.
static Conditions.CombinableCondition or(TimedCondition... conditions)
           Return new combinable condition that is logical sum of conditions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

not

public static TimedCondition not(TimedCondition condition)
Return new timed condition that is a negation of condition.

Parameters:
condition - condition to be negated
Returns:
negated TimedCondition instance.

and

public static Conditions.CombinableCondition and(TimedCondition... 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,

Parameters:
conditions - conditions to conjoin
Returns:
product of conditions
Throws:
IllegalArgumentException - if conditions array is null or empty
See Also:
PollingQuery.interval()

and

public static Conditions.CombinableCondition and(List<TimedCondition> 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,

Parameters:
conditions - conditions to conjoin
Returns:
product of conditions
Throws:
IllegalArgumentException - if conditions array is null or empty
See Also:
PollingQuery.interval()

or

public static Conditions.CombinableCondition or(TimedCondition... 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,

Parameters:
conditions - conditions to sum
Returns:
logical sum of conditions
Throws:
IllegalArgumentException - if conditions array is null or empty
See Also:
PollingQuery.interval()

or

public static Conditions.CombinableCondition or(List<TimedCondition> 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,

Parameters:
conditions - conditions to sum
Returns:
logical sum of conditions
Throws:
IllegalArgumentException - if conditions array is null or empty
See Also:
PollingQuery.interval()

falseCondition

public static TimedCondition falseCondition(long defaultTimeout)
Condition that always returns false. Its interval will be equal to the default timeout.

Parameters:
defaultTimeout - default timeout
Returns:
false condition

falseCondition

public static TimedCondition falseCondition()
Condition that always returns false, with default timeout of 100ms.

Returns:
false condition

dependantCondition

public static TimedCondition dependantCondition(TimedCondition original,
                                                Supplier<TimedCondition> 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 be raised or given exception be propagated by this condition.

Parameters:
original - original condition
dependant - supplier for dependant condition that will only be evaluated given the original condition evaluates to true
Returns:
new dependant condition


Copyright © 2002-2013 Atlassian. All Rights Reserved.