Class CompareMatcher<T extends Comparable<T>>

  • All Implemented Interfaces:
    org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing

    public class CompareMatcher<T extends Comparable<T>>
    extends org.hamcrest.BaseMatcher<T>
    Matcher that matches if the examined Comparable value is greater than the provided value.
    • Method Detail

      • matches

        public boolean matches​(Object item)
      • describeTo

        public void describeTo​(org.hamcrest.Description description)
      • describeMismatch

        public void describeMismatch​(Object item,
                                     org.hamcrest.Description description)
        Specified by:
        describeMismatch in interface org.hamcrest.Matcher<T extends Comparable<T>>
        Overrides:
        describeMismatch in class org.hamcrest.BaseMatcher<T extends Comparable<T>>
      • lessThan

        public static <T extends Comparable<T>> org.hamcrest.Matcher<T> lessThan​(T value)
        Creates a matcher that matches if the examined Comparable value is less than the provided value.

        For example:

         assertThat(Integer.valueOf(221), lessThan(Integer.valueOf(223)))
         
      • greaterThan

        public static <T extends Comparable<T>> org.hamcrest.Matcher<T> greaterThan​(T value)
        Creates a matcher that matches if the examined Comparable value is greater than the provided value.

        For example:

         assertThat(Integer.valueOf(223), greaterThan(Integer.valueOf(221)))