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

  • Direct Known Subclasses:
    Doubles, Floats

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

      • RealNumbers

        public 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.
      • 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.
      • isEqualTo

        protected abstract boolean isEqualTo​(NUMBER actual,
                                             NUMBER expected,
                                             Offset<?> offset)
        Returns true if the two floats parameter are equal within a positive offset, false otherwise.
        It does not rely on the custom comparisonStrategy (if one is set) because using an offset is already a specific comparison strategy.
        Parameters:
        actual - the actual value.
        expected - the expected value.
        offset - the given positive offset.
        Returns:
        true if the two floats parameter are equal within a positive offset, false otherwise.