T - Type of the data to be tested using this condition.public abstract class Check<T> extends Object
| Constructor and Description |
|---|
Check() |
| Modifier and Type | Method and Description |
|---|---|
<U extends T> |
and(Check<? super U> operand)
Compose this check with another one using logical AND operator.
|
String |
name()
Name of the check.
|
<U extends T> |
or(Check<? super U> operand)
Compose this check with another one using logical OR operator.
|
static <T> boolean |
test(T data,
Check<? super T> check) |
static <T> boolean |
test(T data,
Check<? super T> check,
CheckVisitor checkVisitor) |
protected abstract boolean |
test(T data,
CheckVisitor checkVisitor)
Evaluation of the condition on provided data, able to provide full detail of the evaluation using
provided detail collector.
|
static <T> void |
that(T data,
Check<? super T> check) |
static <T> void |
that(T data,
Check<? super T> check,
CheckVisitor logger) |
protected static boolean |
trace(CheckVisitor node,
Object actualValue,
boolean result)
Shortcut method, that traces current node detail, and returns result.
|
protected static boolean |
trace(CheckVisitor checkVisitor,
String expectation,
Object actualValue,
boolean result)
Shortcut method, that traces current leaf detail, and returns result.
|
protected abstract boolean test(T data, CheckVisitor checkVisitor)
data - Data to test by the condition.checkVisitor - Tracer of the evaluation detail.public String name()
public <U extends T> Check<U> and(Check<? super U> operand)
U - Type of the data tested by other check. It may cause up-cast.operand - Another check.public <U extends T> Check<U> or(Check<? super U> operand)
U - Type of the data tested by other check. It may cause up-cast.operand - Another check.public static <T> boolean test(T data,
Check<? super T> check)
public static <T> boolean test(T data,
Check<? super T> check,
CheckVisitor checkVisitor)
public static <T> void that(T data,
Check<? super T> check)
public static <T> void that(T data,
Check<? super T> check,
CheckVisitor logger)
protected static boolean trace(CheckVisitor node, Object actualValue, boolean result)
node - Tracer node wrapping composed condition details.actualValue - Actual value.result - Result of the composed condition.protected static boolean trace(CheckVisitor checkVisitor, String expectation, Object actualValue, boolean result)
checkVisitor - Tracer for tracing condition details.expectation - Description of the expectation.actualValue - Actual value.result - Result of the condition.Copyright © 2018. All rights reserved.