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 to value
    static <T> OrderedAs<T> equalTo​(T value, java.util.Comparator<T> comparator)
    Matches if object is ordered as equal to value, using provided custom comparator.
    static <T> OrderedAs<T> greaterThan​(T value)
    Matches if object is ordered as greater than value
    static <T> org.hamcrest.Matcher<T> greaterThan​(T value, java.util.Comparator<T> c)
    Matches if object is ordered as greater than value using provided custom comparator.
    static <T> OrderedAs<T> greaterThanOrEqualTo​(T value)
    Matches if object is ordered as greater than or equal to value
    static <T> org.hamcrest.Matcher<T> greaterThanOrEqualTo​(T value, java.util.Comparator<T> c)
    Matches if object is ordered as greater than or equal to value using provided custom comparator.
    static <T> OrderedAs<T> lesserThan​(T value)
    Matches if object is ordered as lesser than value
    static <T> org.hamcrest.Matcher<T> lesserThan​(T value, java.util.Comparator<T> c)
    Matches if object is ordered as lesser than value using provided custom comparator.
    static <T> OrderedAs<T> lesserThanOrEqualTo​(T value)
    Matches if object is ordered as lesser than or equal to value
    static <T> org.hamcrest.Matcher<T> lesserThanOrEqualTo​(T value, java.util.Comparator<T> c)
    Matches if object is ordered as lesser than or equal to value using provided custom comparator.
    boolean matches​(java.lang.Object arg0)  
    OrderedAs<T> using​(java.util.Comparator<T> comparator)
    Sets this matcher's comparator

    Methods inherited from class org.hamcrest.BaseMatcher

    _dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • equalTo

      public static <T> OrderedAs<T> equalTo​(T value)
      Matches if object is ordered as equal to value
      Parameters:
      value -
      Returns:
      Throws:
      java.lang.ClassCastException - if custom comparator is not specified and objects are not comparable with each other.
    • equalTo

      public static <T> OrderedAs<T> equalTo​(T value, java.util.Comparator<T> comparator)
      Matches if object is ordered as equal to value, using provided custom comparator.
      Type Parameters:
      T -
      Parameters:
      value -
      comparator - custom Comparator
      Returns:
    • lesserThan

      public static <T> OrderedAs<T> lesserThan​(T value)
      Matches if object is ordered as lesser than value
      Parameters:
      value -
      Returns:
      Throws:
      java.lang.ClassCastException - if custom comparator is not specified and objects are not comparable 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 than value using provided custom comparator.
      Type Parameters:
      T -
      Parameters:
      value -
      comparator - custom Comparator
      Returns:
    • lesserThanOrEqualTo

      public static <T> OrderedAs<T> lesserThanOrEqualTo​(T value)
      Matches if object is ordered as lesser than or equal to value
      Parameters:
      value -
      Returns:
      Throws:
      java.lang.ClassCastException - if custom comparator is not specified and objects are not comparable 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 to value using provided custom comparator.
      Type Parameters:
      T -
      Parameters:
      value -
      comparator - custom Comparator
      Returns:
    • greaterThan

      public static <T> OrderedAs<T> greaterThan​(T value)
      Matches if object is ordered as greater than value
      Parameters:
      value -
      Returns:
      Throws:
      java.lang.ClassCastException - if custom comparator is not specified and objects are not comparable 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 than value using provided custom comparator.
      Type Parameters:
      T -
      Parameters:
      value -
      comparator - custom Comparator
      Returns:
    • greaterThanOrEqualTo

      public static <T> OrderedAs<T> greaterThanOrEqualTo​(T value)
      Matches if object is ordered as greater than or equal to value
      Parameters:
      value -
      Returns:
      Throws:
      java.lang.ClassCastException - if custom comparator is not specified and objects are not comparable 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 to value using provided custom comparator.
      Type Parameters:
      T -
      Parameters:
      value -
      comparator - custom Comparator
      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

      public OrderedAs<T> using​(java.util.Comparator<T> comparator)
      Sets this matcher's comparator
      Parameters:
      comparator -
      Returns: