Class ComparableAssert<T extends Comparable<T>>

Type Parameters:
T - the type of Comparable this template can verify.
Direct Known Subclasses:
BigDecimalAssert

public abstract class ComparableAssert<T extends Comparable<T>> extends GenericAssert<T>
Understands a template for assertion methods, applicable to Comparables.
  • Constructor Details

    • ComparableAssert

      protected ComparableAssert(T actual)
      Creates a new ComparableAssert.
      Parameters:
      actual - the target to verify.
  • Method Details

    • isEqualByComparingTo

      protected abstract ComparableAssert<T> isEqualByComparingTo(T expected)
      Verifies that the actual Comparable is equal to the given one.
      Parameters:
      expected - the given Comparable to compare the actual Comparable to.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not equal to the given one.
    • isNotEqualByComparingTo

      protected abstract ComparableAssert<T> isNotEqualByComparingTo(T expected)
      Verifies that the actual Comparable is not equal to the given one.
      Parameters:
      expected - the given Comparable to use to compare to the actual Comparable.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is equal to the given one.
    • isLessThan

      protected abstract ComparableAssert<T> isLessThan(T other)
      Verifies that the actual Comparable is less than the given one.
      Parameters:
      other - the given value.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not less than the given one.
    • isGreaterThan

      protected abstract ComparableAssert<T> isGreaterThan(T other)
      Verifies that the actual Comparable is greater than the given one.
      Parameters:
      other - the given value.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not greater than the given one.
    • isLessThanOrEqualTo

      protected abstract ComparableAssert<T> isLessThanOrEqualTo(T other)
      Verifies that the actual Comparable is less than or equal to the given one.
      Parameters:
      other - the given value.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not less than or equal to the given one.
    • isGreaterThanOrEqualTo

      protected abstract ComparableAssert<T> isGreaterThanOrEqualTo(T other)
      Verifies that the actual Comparable is greater than or equal to the given one.
      Parameters:
      other - the given value.
      Returns:
      this assertion object.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not greater than or equal to the given one.
    • assertIsEqualByComparingTo

      protected final void assertIsEqualByComparingTo(T expected)
      Verifies that the actual Comparable is equal to the given one.
      Parameters:
      expected - the given Comparable to compare the actual Comparable to.
      Throws:
      AssertionError - if the actual Comparable value is null.
      AssertionError - if the actual Comparable value is not equal to the given one.
    • assertIsNotEqualByComparingTo

      protected final void assertIsNotEqualByComparingTo(T expected)
      Verifies that the actual Comparable is not equal to the given one.
      Parameters:
      expected - the given Comparable to use to compare to the actual Comparable.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is equal to the given one.
    • assertIsLessThan

      protected final void assertIsLessThan(T other)
      Verifies that the actual Comparable is less than the given one.
      Parameters:
      other - the given value.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not less than the given one.
    • assertIsGreaterThan

      protected final void assertIsGreaterThan(T other)
      Verifies that the actual Comparable is greater than the given one.
      Parameters:
      other - the given value.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not greater than the given one.
    • assertIsLessThanOrEqualTo

      protected final void assertIsLessThanOrEqualTo(T other)
      Verifies that the actual Comparable is less than or equal to the given one.
      Parameters:
      other - the given value.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not less than or equal to the given one.
    • assertIsGreaterThanOrEqualTo

      protected final void assertIsGreaterThanOrEqualTo(T other)
      Verifies that the actual Comparable is greater than or equal to the given one.
      Parameters:
      other - the given value.
      Throws:
      AssertionError - if the actual Comparable is null.
      AssertionError - if the actual Comparable is not greater than or equal to the given one.