|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hamcrest.comparator.ComparatorMatcherBuilder<T>
public final class ComparatorMatcherBuilder<T>
| Method Summary | ||
|---|---|---|
static
|
comparedBy(Comparator<T> comparator)
Creates a matcher factory for matchers of Comparatorss of T. |
|
Matcher<T> |
comparesEqualTo(T value)
Creates a matcher of T object that matches when the examined object is
equal to the specified value, as reported by the Comparator used to
create this builder. |
|
Matcher<T> |
greaterThan(T value)
Creates a matcher of T object that matches when the examined object is
greater than the specified value, as reported by the Comparator used to
create this builder. |
|
Matcher<T> |
greaterThanOrEqualTo(T value)
Creates a matcher of T object that matches when the examined object is
greater than or equal to the specified value, as reported by the Comparator used to
create this builder. |
|
Matcher<T> |
lessThan(T value)
Creates a matcher of T object that matches when the examined object is
less than the specified value, as reported by the Comparator used to
create this builder. |
|
Matcher<T> |
lessThanOrEqualTo(T value)
Creates a matcher of T object that matches when the examined object is
less than or equal to the specified value, as reported by the Comparator used to
create this builder. |
|
static
|
usingNaturalOrdering()
Creates a matcher factory for matchers of Comparables. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T extends Comparable<T>> ComparatorMatcherBuilder<T> usingNaturalOrdering()
Comparables.
For example:
assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().lessThanOrEqualTo(1))
public static <T> ComparatorMatcherBuilder<T> comparedBy(Comparator<T> comparator)
Comparatorss of T.
For example:
assertThat(5, comparedBy(new Comparator() { public int compare(Integer o1, Integer o2) { return -o1.compareTo(o2); } }).lessThan(4))
public Matcher<T> comparesEqualTo(T value)
T object that matches when the examined object is
equal to the specified value, as reported by the Comparator used to
create this builder.
For example:
assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().comparesEqualTo(1))
value - the value which, when passed to the Comparator supplied to this builder, should return zeropublic Matcher<T> greaterThan(T value)
T object that matches when the examined object is
greater than the specified value, as reported by the Comparator used to
create this builder.
For example:
assertThat(2, ComparatorMatcherBuilder.usingNaturalOrdering().greaterThan(1))
value - the value which, when passed to the Comparator supplied to this builder, should return greater
than zeropublic Matcher<T> greaterThanOrEqualTo(T value)
T object that matches when the examined object is
greater than or equal to the specified value, as reported by the Comparator used to
create this builder.
For example:
assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().greaterThanOrEqualTo(1))
value - the value which, when passed to the Comparator supplied to this builder, should return greater
than or equal to zeropublic Matcher<T> lessThan(T value)
T object that matches when the examined object is
less than the specified value, as reported by the Comparator used to
create this builder.
For example:
assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().lessThan(2))
value - the value which, when passed to the Comparator supplied to this builder, should return less
than zeropublic Matcher<T> lessThanOrEqualTo(T value)
T object that matches when the examined object is
less than or equal to the specified value, as reported by the Comparator used to
create this builder.
For example:
assertThat(1, ComparatorMatcherBuilder.usingNaturalOrdering().lessThanOrEqualTo(1))
value - the value which, when passed to the Comparator supplied to this builder, should return less
than or equal to zero
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||