Class AbstractComparableAssert<S extends AbstractComparableAssert<S,​A>,​A extends java.lang.Comparable<? super A>>

    • Constructor Detail

      • AbstractComparableAssert

        protected AbstractComparableAssert​(A actual,
                                           java.lang.Class<?> selfType)
    • Method Detail

      • isLessThan

        public S isLessThan​(A other)
        Verifies that the actual value is less than the given one.
        Specified by:
        isLessThan in interface ComparableAssert<S extends AbstractComparableAssert<S,​A>,​A extends java.lang.Comparable<? super A>>
        Parameters:
        other - the given value to compare the actual value to.
        Returns:
        this assertion object.
      • isLessThanOrEqualTo

        public S isLessThanOrEqualTo​(A other)
        Verifies that the actual value is less than or equal to the given one.
        Specified by:
        isLessThanOrEqualTo in interface ComparableAssert<S extends AbstractComparableAssert<S,​A>,​A extends java.lang.Comparable<? super A>>
        Parameters:
        other - the given value to compare the actual value to.
        Returns:
        this assertion object.
      • isGreaterThan

        public S isGreaterThan​(A other)
        Verifies that the actual value is greater than the given one.
        Specified by:
        isGreaterThan in interface ComparableAssert<S extends AbstractComparableAssert<S,​A>,​A extends java.lang.Comparable<? super A>>
        Parameters:
        other - the given value to compare the actual value to.
        Returns:
        this assertion object.
      • isGreaterThanOrEqualTo

        public S isGreaterThanOrEqualTo​(A other)
        Verifies that the actual value is greater than or equal to the given one.
        Specified by:
        isGreaterThanOrEqualTo in interface ComparableAssert<S extends AbstractComparableAssert<S,​A>,​A extends java.lang.Comparable<? super A>>
        Parameters:
        other - the given value to compare the actual value to.
        Returns:
        this assertion object.
      • usingComparator

        public S usingComparator​(java.util.Comparator<? super A> customComparator)
        Description copied from class: AbstractAssert
        Use given custom comparator instead of relying on actual type A equals method for incoming assertion checks.

        Custom comparator is bound to assertion instance, meaning that if a new assertion is created, it will use default comparison strategy.

        Examples :

         // frodo and sam are instances of Character with Hobbit race (obviously :).
         // raceComparator implements Comparator<Character> 
         assertThat(frodo).usingComparator(raceComparator).isEqualTo(sam); 
         
        Specified by:
        usingComparator in interface Assert<S extends AbstractComparableAssert<S,​A>,​A extends java.lang.Comparable<? super A>>
        Overrides:
        usingComparator in class AbstractAssert<S extends AbstractComparableAssert<S,​A>,​A extends java.lang.Comparable<? super A>>
        Parameters:
        customComparator - the comparator to use for incoming assertion checks.
        Returns:
        this assertion object.