Class Floats


  • public class Floats
    extends RealNumbers<java.lang.Float>
    Reusable assertions for Floats.
    Author:
    Alex Ruiz, Joel Costigliola
    • Method Detail

      • zero

        protected java.lang.Float zero()
        Specified by:
        zero in class Numbers<java.lang.Float>
      • NaN

        protected java.lang.Float NaN()
        Specified by:
        NaN in class RealNumbers<java.lang.Float>
      • isEqualTo

        protected boolean isEqualTo​(java.lang.Float actual,
                                    java.lang.Float expected,
                                    Offset<?> offset)
        Description copied from class: RealNumbers
        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.
        Specified by:
        isEqualTo in class RealNumbers<java.lang.Float>
        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.
      • assertEqual

        public void assertEqual​(AssertionInfo info,
                                java.lang.Float actual,
                                java.lang.Float expected,
                                Offset<java.lang.Float> offset)
        Verifies that two floats 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:
        java.lang.NullPointerException - if the given offset is null.
        java.lang.AssertionError - if the actual value is not equal to the expected one.