Class RealNumbers<NUMBER extends java.lang.Number & java.lang.Comparable<NUMBER>>

  • Direct Known Subclasses:
    Doubles, Floats

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

      • RealNumbers

        protected RealNumbers()
    • Method Detail

      • 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:
        java.lang.AssertionError - if the actual value is not equal to NaN.
      • absBigDecimalDiff

        protected java.math.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:
        java.lang.AssertionError - if the actual value is equal to NaN.
      • isFinite

        protected abstract boolean isFinite​(NUMBER value)
      • isNotFinite

        protected abstract boolean isNotFinite​(NUMBER value)
      • 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)