Class ComparableSubject<T extends java.lang.Comparable>

    • Field Detail

      • actual

        private final T extends java.lang.Comparable actual
        Constructor for use by subclasses. If you want to create an instance of this class itself, call check(...).that(actual).
    • Constructor Detail

      • ComparableSubject

        protected ComparableSubject​(FailureMetadata metadata,
                                    T actual)
    • Method Detail

      • isIn

        public final void isIn​(com.google.common.collect.Range<T> range)
        Checks that the subject is in range.
      • isNotIn

        public final void isNotIn​(com.google.common.collect.Range<T> range)
        Checks that the subject is not in range.
      • isEquivalentAccordingToCompareTo

        public void isEquivalentAccordingToCompareTo​(T expected)
        Checks that the subject is equivalent to other according to Comparable.compareTo(T), (i.e., checks that a.comparesTo(b) == 0).

        Note: Do not use this method for checking object equality. Instead, use Subject.isEqualTo(Object).

      • isGreaterThan

        public final void isGreaterThan​(T other)
        Checks that the subject is greater than other.

        To check that the subject is greater than or equal to other, use isAtLeast(T).

      • isLessThan

        public final void isLessThan​(T other)
        Checks that the subject is less than other.

        To check that the subject is less than or equal to other, use isAtMost(T).

      • isAtMost

        public final void isAtMost​(T other)
        Checks that the subject is less than or equal to other.

        To check that the subject is strictly less than other, use isLessThan(T).

      • isAtLeast

        public final void isAtLeast​(T other)
        Checks that the subject is greater than or equal to other.

        To check that the subject is strictly greater than other, use isGreaterThan(T).