Class ComparableSubject<T extends java.lang.Comparable>

    • Constructor Detail

      • ComparableSubject

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

      • isIn

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

        public final void isNotIn​(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).