Top Description Inners Fields Constructors Methods
org.hamcrest

public abstract Class Condition<T>

extends Object
Class Inheritance
Known Direct Subclasses
org.hamcrest.Condition.Matched, org.hamcrest.Condition.NotMatched

A Condition implements part of a multi-step match. We sometimes need to write matchers that have a sequence of steps, where each step depends on the result of the previous step and we can stop processing as soon as a step fails. These classes provide infrastructure for writing such a sequence. Based on https://github.com/npryce/maybe-java
Author
Steve Freeman 2012 http://www.hamcrest.com

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
public static interface

Field Summary

Modifier and TypeField and Description
public static final Condition.NotMatched<Object>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public abstract <U> Condition<U>
and(Condition.Step<? super T, U> mapping)

public static <T> Condition<T>
matched(final T theValue, final Description mismatch)

public abstract boolean
matching(Matcher<T> match, String message)

public final boolean
matching(Matcher<T> match)

public static <T> Condition<T>
public final <U> Condition<U>
then(Condition.Step<? super T, U> mapping)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NOT_MATCHEDback to summary
public static final Condition.NotMatched<Object> NOT_MATCHED

Constructor Detail

Conditionback to summary
private Condition()

Method Detail

andback to summary
public abstract <U> Condition<U> and(Condition.Step<? super T, U> mapping)
matchedback to summary
public static <T> Condition<T> matched(final T theValue, final Description mismatch)
matchingback to summary
public abstract boolean matching(Matcher<T> match, String message)
matchingback to summary
public final boolean matching(Matcher<T> match)
notMatchedback to summary
public static <T> Condition<T> notMatched()
Annotations
@SuppressWarnings:unchecked
thenback to summary
public final <U> Condition<U> then(Condition.Step<? super T, U> mapping)
org.hamcrest back to summary

private final Class Condition.Matched<T>

extends Condition<T>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final Description
private final T
Inherited from org.hamcrest.Condition:
NOT_MATCHED

Constructor Summary

AccessConstructor and Description
private
Matched(T theValue, Description mismatch)

Method Summary

Modifier and TypeMethod and Description
public <U> Condition<U>
and(Condition.Step<? super T, U> next)

Implements abstract org.hamcrest.Condition.and.

public boolean
matching(Matcher<T> matcher, String message)

Implements abstract org.hamcrest.Condition.matching.

Inherited from org.hamcrest.Condition:
matchedmatchingnotMatchedthen

Field Detail

mismatchback to summary
private final Description mismatch
theValueback to summary
private final T theValue

Constructor Detail

Matchedback to summary
private Matched(T theValue, Description mismatch)

Method Detail

andback to summary
public <U> Condition<U> and(Condition.Step<? super T, U> next)

Implements abstract org.hamcrest.Condition.and.

Annotations
@Override
matchingback to summary
public boolean matching(Matcher<T> matcher, String message)

Implements abstract org.hamcrest.Condition.matching.

Annotations
@Override
org.hamcrest back to summary

private final Class Condition.NotMatched<T>

extends Condition<T>
Class Inheritance

Field Summary

Inherited from org.hamcrest.Condition:
NOT_MATCHED

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public <U> Condition<U>
and(Condition.Step<? super T, U> mapping)

Implements abstract org.hamcrest.Condition.and.

public boolean
matching(Matcher<T> match, String message)

Implements abstract org.hamcrest.Condition.matching.

Inherited from org.hamcrest.Condition:
matchedmatchingnotMatchedthen

Constructor Detail

NotMatchedback to summary
private NotMatched()

Method Detail

andback to summary
public <U> Condition<U> and(Condition.Step<? super T, U> mapping)

Implements abstract org.hamcrest.Condition.and.

Annotations
@Override
matchingback to summary
public boolean matching(Matcher<T> match, String message)

Implements abstract org.hamcrest.Condition.matching.

Annotations
@Override
org.hamcrest back to summary

public Interface Condition.Step<I, O>


Method Summary

Modifier and TypeMethod and Description
public Condition<O>
apply(I value, Description mismatch)

Method Detail

applyback to summary
public Condition<O> apply(I value, Description mismatch)