Top Constructors Methods
org.hamcrest.number

public Class OrderingComparison

extends Object
Class Inheritance
Imports
org.hamcrest.Matcher, org.hamcrest.comparator.ComparatorMatcherBuilder

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <T extends Comparable<T>> Matcher<T>
comparesEqualTo(T
the value which, when passed to the compareTo method of the examined object, should return zero
value
)

Creates a matcher of Comparable object that matches when the examined object is equal to the specified value, as reported by the compareTo method of the examined object.

public static <T extends Comparable<T>> Matcher<T>
greaterThan(T
the value which, when passed to the compareTo method of the examined object, should return greater than zero
value
)

Creates a matcher of Comparable object that matches when the examined object is greater than the specified value, as reported by the compareTo method of the examined object.

public static <T extends Comparable<T>> Matcher<T>
greaterThanOrEqualTo(T
the value which, when passed to the compareTo method of the examined object, should return greater than or equal to zero
value
)

Creates a matcher of Comparable object that matches when the examined object is greater than or equal to the specified value, as reported by the compareTo method of the examined object.

public static <T extends Comparable<T>> Matcher<T>
lessThan(T
the value which, when passed to the compareTo method of the examined object, should return less than zero
value
)

Creates a matcher of Comparable object that matches when the examined object is less than the specified value, as reported by the compareTo method of the examined object.

public static <T extends Comparable<T>> Matcher<T>
lessThanOrEqualTo(T
the value which, when passed to the compareTo method of the examined object, should return less than or equal to zero
value
)

Creates a matcher of Comparable object that matches when the examined object is less than or equal to the specified value, as reported by the compareTo method of the examined object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

OrderingComparisonback to summary
private OrderingComparison()

Method Detail

comparesEqualToback to summary
public static <T extends Comparable<T>> Matcher<T> comparesEqualTo(T value)

Creates a matcher of Comparable object that matches when the examined object is equal to the specified value, as reported by the compareTo method of the examined object. For example:

assertThat(1, comparesEqualTo(1))
Parameters
value:T

the value which, when passed to the compareTo method of the examined object, should return zero

greaterThanback to summary
public static <T extends Comparable<T>> Matcher<T> greaterThan(T value)

Creates a matcher of Comparable object that matches when the examined object is greater than the specified value, as reported by the compareTo method of the examined object. For example:

assertThat(2, greaterThan(1))
Parameters
value:T

the value which, when passed to the compareTo method of the examined object, should return greater than zero

greaterThanOrEqualToback to summary
public static <T extends Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)

Creates a matcher of Comparable object that matches when the examined object is greater than or equal to the specified value, as reported by the compareTo method of the examined object. For example:

assertThat(1, greaterThanOrEqualTo(1))
Parameters
value:T

the value which, when passed to the compareTo method of the examined object, should return greater than or equal to zero

lessThanback to summary
public static <T extends Comparable<T>> Matcher<T> lessThan(T value)

Creates a matcher of Comparable object that matches when the examined object is less than the specified value, as reported by the compareTo method of the examined object. For example:

assertThat(1, lessThan(2))
Parameters
value:T

the value which, when passed to the compareTo method of the examined object, should return less than zero

lessThanOrEqualToback to summary
public static <T extends Comparable<T>> Matcher<T> lessThanOrEqualTo(T value)

Creates a matcher of Comparable object that matches when the examined object is less than or equal to the specified value, as reported by the compareTo method of the examined object. For example:

assertThat(1, lessThanOrEqualTo(1))
Parameters
value:T

the value which, when passed to the compareTo method of the examined object, should return less than or equal to zero