Class ComparableAssert


  • public final class ComparableAssert
    extends Object
    Assertions for Comparable.
    Since:
    1.0.0
    Version:
    $Id$
    Author:
    tlerios@marketcetera.com
    • Constructor Detail

      • ComparableAssert

        private ComparableAssert()
        Constructor. It is private so that no instances can be created.
    • Method Detail

      • assertComparable

        public static <T extends Comparable<? super T>> void assertComparable​(String message,
                                                                              T c,
                                                                              T cEqual,
                                                                              T cGreater,
                                                                              String nullMessage)
        Asserts that the given target object implements Comparable correctly. If the assertion does not hold, the AssertionError thrown starts with the given message, which may be null if no such custom message prefix is desired.
        Type Parameters:
        T - a T extends Comparable<? super T> value
        Parameters:
        message - The message.
        c - The target object.
        cEqual - Another object that is equal to (but not the same as) the target object.
        cGreater - Another object that is greater than the target object.
        nullMessage - The message of the NullPointerException expected for comparison against null. If null, no message check is performed.
      • assertComparable

        public static <T extends Comparable<? super T>> void assertComparable​(T c,
                                                                              T cEqual,
                                                                              T cGreater,
                                                                              String nullMessage)
        Asserts that the given target object implements Comparable correctly.
        Type Parameters:
        T - a T extends Comparable<? super T> value
        Parameters:
        c - The target object.
        cEqual - Another object that is equal to (but not the same as) the target object.
        cGreater - Another object that is greater than the target object.
        nullMessage - The message of the NullPointerException expected for comparison against null. If null, no message check is performed.
      • assertComparable

        public static <T extends Comparable<? super T>> void assertComparable​(String message,
                                                                              T c,
                                                                              T cEqual,
                                                                              T cGreater)
        Asserts that the given target object implements Comparable correctly. No message check takes place during comparison against null. If the assertion does not hold, the AssertionError thrown starts with the given message, which may be null if no such custom message prefix is desired.
        Type Parameters:
        T - a T extends Comparable<? super T> value
        Parameters:
        message - The message.
        c - The target object.
        cEqual - Another object that is equal to (but not the same as) the target object.
        cGreater - Another object that is greater than the target object.
      • assertComparable

        public static <T extends Comparable<? super T>> void assertComparable​(T c,
                                                                              T cEqual,
                                                                              T cGreater)
        Asserts that the given target object implements Comparable correctly. No message check takes place during comparison against null.
        Type Parameters:
        T - a T extends Comparable<? super T> value
        Parameters:
        c - The target object.
        cEqual - Another object that is equal to (but not the same as) the target object.
        cGreater - Another object that is greater than the target object.