Class OrderedAs<T>
java.lang.Object
org.hamcrest.BaseMatcher<T>
com.onenetwork.platform.tools.test.matcher.OrderedAs<T>
- All Implemented Interfaces:
org.hamcrest.Matcher<T>
,org.hamcrest.SelfDescribing
public class OrderedAs<T>
extends org.hamcrest.BaseMatcher<T>
Matchers to test if object is ordered in a particular way compared to
the actual object.
By default
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
OrderedAs.Kind
protected static class
OrderedAs.NaturalOrdering<U>
-
Method Summary
Modifier and Type Method Description void
describeTo(org.hamcrest.Description description)
static <T> OrderedAs<T>
equalTo(T value)
Matches if object is ordered as equal tovalue
static <T> OrderedAs<T>
equalTo(T value, java.util.Comparator<T> comparator)
Matches if object is ordered as equal tovalue
, using provided custom comparator.static <T> OrderedAs<T>
greaterThan(T value)
Matches if object is ordered as greater thanvalue
static <T> org.hamcrest.Matcher<T>
greaterThan(T value, java.util.Comparator<T> c)
Matches if object is ordered as greater thanvalue
using provided custom comparator.static <T> OrderedAs<T>
greaterThanOrEqualTo(T value)
Matches if object is ordered as greater than or equal tovalue
static <T> org.hamcrest.Matcher<T>
greaterThanOrEqualTo(T value, java.util.Comparator<T> c)
Matches if object is ordered as greater than or equal tovalue
using provided custom comparator.static <T> OrderedAs<T>
lesserThan(T value)
Matches if object is ordered as lesser thanvalue
static <T> org.hamcrest.Matcher<T>
lesserThan(T value, java.util.Comparator<T> c)
Matches if object is ordered as lesser thanvalue
using provided custom comparator.static <T> OrderedAs<T>
lesserThanOrEqualTo(T value)
Matches if object is ordered as lesser than or equal tovalue
static <T> org.hamcrest.Matcher<T>
lesserThanOrEqualTo(T value, java.util.Comparator<T> c)
Matches if object is ordered as lesser than or equal tovalue
using provided custom comparator.boolean
matches(java.lang.Object arg0)
OrderedAs<T>
using(java.util.Comparator<T> comparator)
Sets this matcher's comparator
-
Method Details
-
equalTo
Matches if object is ordered as equal tovalue
- Parameters:
value
-- Returns:
- Throws:
java.lang.ClassCastException
- if custom comparator is not specified and objects are notcomparable
with each other.
-
equalTo
Matches if object is ordered as equal tovalue
, using provided custom comparator.- Type Parameters:
T
-- Parameters:
value
-comparator
- customComparator
- Returns:
-
lesserThan
Matches if object is ordered as lesser thanvalue
- Parameters:
value
-- Returns:
- Throws:
java.lang.ClassCastException
- if custom comparator is not specified and objects are notcomparable
with each other.
-
lesserThan
public static <T> org.hamcrest.Matcher<T> lesserThan(T value, java.util.Comparator<T> c)Matches if object is ordered as lesser thanvalue
using provided custom comparator.- Type Parameters:
T
-- Parameters:
value
-comparator
- customComparator
- Returns:
-
lesserThanOrEqualTo
Matches if object is ordered as lesser than or equal tovalue
- Parameters:
value
-- Returns:
- Throws:
java.lang.ClassCastException
- if custom comparator is not specified and objects are notcomparable
with each other.
-
lesserThanOrEqualTo
public static <T> org.hamcrest.Matcher<T> lesserThanOrEqualTo(T value, java.util.Comparator<T> c)Matches if object is ordered as lesser than or equal tovalue
using provided custom comparator.- Type Parameters:
T
-- Parameters:
value
-comparator
- customComparator
- Returns:
-
greaterThan
Matches if object is ordered as greater thanvalue
- Parameters:
value
-- Returns:
- Throws:
java.lang.ClassCastException
- if custom comparator is not specified and objects are notcomparable
with each other.
-
greaterThan
public static <T> org.hamcrest.Matcher<T> greaterThan(T value, java.util.Comparator<T> c)Matches if object is ordered as greater thanvalue
using provided custom comparator.- Type Parameters:
T
-- Parameters:
value
-comparator
- customComparator
- Returns:
-
greaterThanOrEqualTo
Matches if object is ordered as greater than or equal tovalue
- Parameters:
value
-- Returns:
- Throws:
java.lang.ClassCastException
- if custom comparator is not specified and objects are notcomparable
with each other.
-
greaterThanOrEqualTo
public static <T> org.hamcrest.Matcher<T> greaterThanOrEqualTo(T value, java.util.Comparator<T> c)Matches if object is ordered as greater than or equal tovalue
using provided custom comparator.- Type Parameters:
T
-- Parameters:
value
-comparator
- customComparator
- Returns:
-
describeTo
public void describeTo(org.hamcrest.Description description)- See Also:
SelfDescribing.describeTo(org.hamcrest.Description)
-
matches
public boolean matches(java.lang.Object arg0)- See Also:
Matcher.matches(java.lang.Object)
-
using
Sets this matcher's comparator- Parameters:
comparator
-- Returns:
-