Package org.fest.assertions.core
Class Condition<T>
- java.lang.Object
-
- org.fest.assertions.core.Condition<T>
-
- Type Parameters:
T- the type of object this condition accepts.
- All Implemented Interfaces:
Descriptable<Condition<T>>
public abstract class Condition<T> extends java.lang.Object implements Descriptable<Condition<T>>
A condition to be met by an object.- Author:
- Yvonne Wang, Alex Ruiz
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Condition<T>as(java.lang.String newDescription)Sets the description of this object.Condition<T>as(Description newDescription)Sets the description of this object.Condition<T>describedAs(java.lang.String newDescription)Alias forsince "as" is a keyword in Groovy.Descriptable.as(String)Condition<T>describedAs(Description newDescription)Alias forsince "as" is a keyword in Groovy.Descriptable.as(String)Descriptiondescription()Returns the description of this condition.abstract booleanmatches(T value)Verifies that the given value satisfies this condition.java.lang.StringtoString()
-
-
-
Constructor Detail
-
Condition
public Condition()
Creates a newCondition. The default description of this condition will the simple name of the condition's class.
-
Condition
public Condition(java.lang.String description)
Creates a newCondition.- Parameters:
description- the description of this condition.- Throws:
java.lang.NullPointerException- if the given description isnull.
-
Condition
public Condition(Description description)
Creates a newCondition.- Parameters:
description- the description of this condition.- Throws:
java.lang.NullPointerException- if the given description isnull.
-
-
Method Detail
-
describedAs
public Condition<T> describedAs(java.lang.String newDescription)
Alias forsince "as" is a keyword in Groovy.Descriptable.as(String)- Specified by:
describedAsin interfaceDescriptable<T>- Parameters:
newDescription- the new description to set.- Returns:
thisobject.
-
as
public Condition<T> as(java.lang.String newDescription)
Sets the description of this object.- Specified by:
asin interfaceDescriptable<T>- Parameters:
newDescription- the new description to set.- Returns:
thisobject.- See Also:
Descriptable.describedAs(String)
-
describedAs
public Condition<T> describedAs(Description newDescription)
Alias forsince "as" is a keyword in Groovy. To remove or clear the description, pass aDescriptable.as(String)as argument.EmptyTextDescriptionThis overloaded version of "describedAs" offers more flexibility than the one taking a
Stringby allowing users to pass their own implementation of a description. For example, a description that creates its value lazily, only when an assertion failure occurs.- Specified by:
describedAsin interfaceDescriptable<T>- Parameters:
newDescription- the new description to set.- Returns:
thisobject.
-
as
public Condition<T> as(Description newDescription)
Sets the description of this object. To remove or clear the description, pass aas argument.EmptyTextDescriptionThis overloaded version of "describedAs" offers more flexibility than the one taking a
Stringby allowing users to pass their own implementation of a description. For example, a description that creates its value lazily, only when an assertion failure occurs.- Specified by:
asin interfaceDescriptable<T>- Parameters:
newDescription- the new description to set.- Returns:
thisobject.- See Also:
Descriptable.describedAs(Description)
-
description
public Description description()
Returns the description of this condition.- Returns:
- the description of this condition.
-
matches
public abstract boolean matches(T value)
Verifies that the given value satisfies this condition.- Parameters:
value- the value to verify.- Returns:
trueif the given value satisfies this condition;falseotherwise.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-