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>>
A condition to be met by an object.
- Author:
- Yvonne Wang, Alex Ruiz
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the description of this object.as
(Description newDescription) Sets the description of this object.describedAs
(String newDescription) Alias for
since "as" is a keyword in Groovy.Descriptable.as(String)
describedAs
(Description newDescription) Alias for
since "as" is a keyword in Groovy.Descriptable.as(String)
Returns the description of this condition.abstract boolean
Verifies that the given value satisfies this condition.toString()
-
Constructor Details
-
Condition
public Condition()Creates a newCondition
. The default description of this condition will the simple name of the condition's class. -
Condition
Creates a newCondition
.- Parameters:
description
- the description of this condition.- Throws:
NullPointerException
- if the given description isnull
.
-
Condition
Creates a newCondition
.- Parameters:
description
- the description of this condition.- Throws:
NullPointerException
- if the given description isnull
.
-
-
Method Details
-
describedAs
Alias for
since "as" is a keyword in Groovy.Descriptable.as(String)
- Specified by:
describedAs
in interfaceDescriptable<T>
- Parameters:
newDescription
- the new description to set.- Returns:
this
object.
-
as
Sets the description of this object.- Specified by:
as
in interfaceDescriptable<T>
- Parameters:
newDescription
- the new description to set.- Returns:
this
object.- See Also:
-
describedAs
Alias for
since "as" is a keyword in Groovy. To remove or clear the description, pass aDescriptable.as(String)
as argument.EmptyTextDescription
This overloaded version of "describedAs" offers more flexibility than the one taking a
String
by 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:
describedAs
in interfaceDescriptable<T>
- Parameters:
newDescription
- the new description to set.- Returns:
this
object.
-
as
Sets the description of this object. To remove or clear the description, pass a
as argument.EmptyTextDescription
This overloaded version of "describedAs" offers more flexibility than the one taking a
String
by 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:
as
in interfaceDescriptable<T>
- Parameters:
newDescription
- the new description to set.- Returns:
this
object.- See Also:
-
description
Returns the description of this condition.- Returns:
- the description of this condition.
-
matches
Verifies that the given value satisfies this condition.- Parameters:
value
- the value to verify.- Returns:
true
if the given value satisfies this condition;false
otherwise.
-
toString
-