Class RealNumbers<NUMBER extends Number & Comparable<NUMBER>>

Direct Known Subclasses:
Doubles, Floats

public abstract class RealNumbers<NUMBER extends Number & Comparable<NUMBER>> extends Numbers<NUMBER>
Base class of reusable assertions for real numbers (float and double).
  • Constructor Details

    • RealNumbers

      protected RealNumbers()
    • RealNumbers

      protected RealNumbers(ComparisonStrategy comparisonStrategy)
  • Method Details

    • assertIsNaN

      public void assertIsNaN(AssertionInfo info, NUMBER actual)
      Verifies that the actual value is equal to NaN.
      It does not rely on the custom comparisonStrategy (if one is set).
      Parameters:
      info - contains information about the assertion.
      actual - the actual value.
      Throws:
      AssertionError - if the actual value is not equal to NaN.
    • absBigDecimalDiff

      protected BigDecimal absBigDecimalDiff(NUMBER number1, NUMBER number2)
    • NaN

      protected abstract NUMBER NaN()
    • assertIsNotNaN

      public void assertIsNotNaN(AssertionInfo info, NUMBER actual)
      Verifies that the actual value is not equal to NaN.
      Parameters:
      info - contains information about the assertion.
      actual - the actual value.
      Throws:
      AssertionError - if the actual value is equal to NaN.
    • isGreaterThan

      protected boolean isGreaterThan(NUMBER value, NUMBER other)
      Specified by:
      isGreaterThan in class Numbers<NUMBER extends Number & Comparable<NUMBER>>
    • assertIsFinite

      public void assertIsFinite(AssertionInfo info, NUMBER actual)
    • isFinite

      protected abstract boolean isFinite(NUMBER value)
    • assertIsNotFinite

      public void assertIsNotFinite(AssertionInfo info, NUMBER actual)
    • isNotFinite

      protected abstract boolean isNotFinite(NUMBER value)
    • assertIsInfinite

      public void assertIsInfinite(AssertionInfo info, NUMBER actual)
    • isInfinite

      protected abstract boolean isInfinite(NUMBER value)
    • assertIsNotInfinite

      public void assertIsNotInfinite(AssertionInfo info, NUMBER actual)
    • isNanOrInfinite

      public boolean isNanOrInfinite(NUMBER value)
      Returns true is if the given value is Nan or Infinite, false otherwise.
      Parameters:
      value - the value to check
      Returns:
      true is if the given value is Nan or Infinite, false otherwise.
    • isNaN

      protected abstract boolean isNaN(NUMBER value)
    • isNotInfinite

      protected abstract boolean isNotInfinite(NUMBER value)