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

      public RealNumbers()
    • RealNumbers

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

      protected abstract NUMBER NaN()
    • assertEqual

      public void assertEqual(AssertionInfo info, NUMBER actual, NUMBER expected, Offset<NUMBER> offset)
      Verifies that two real numbers are equal within a positive offset.
      It does not rely on the custom comparisonStrategy (if one is set) because using an offset is already a specific comparison strategy.
      Parameters:
      info - contains information about the assertion.
      actual - the actual value.
      expected - the expected value.
      offset - the given positive offset.
      Throws:
      NullPointerException - if the given offset is null.
      AssertionError - if the actual value is null.
      AssertionError - if the actual value is not equal to the expected one.
    • 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>>