Class Assert2


  • public class Assert2
    extends Object
    Custom JUnit 4 assertions.
    Since:
    2018-05-13
    • Method Detail

      • assertNearlyEquals

        public static void assertNearlyEquals​(float expected,
                                              float actual)
        Returns the result of assertNearlyEquals(float, float, float), with Misc.defaultMaxRelativeDiffFloat.
      • assertNearlyEquals

        public static void assertNearlyEquals​(float expected,
                                              float actual,
                                              float maxRelDiff)
        Asserts that two floats are nearly equal. If they are not, an AssertionError is thrown.
        Parameters:
        expected - expected value
        actual - the value to check against expected
        maxRelDiff - the maximum relative difference the two numbers may have and still be considered equal.
      • assertArrayNearlyEquals

        public static void assertArrayNearlyEquals​(float[] expecteds,
                                                   float[] actuals,
                                                   float maxRelDiff)
        Asserts that two float arrays are nearly equal by comparing analogous elements in the two arrays with Misc.nearlyEquals(float, float, float). If they are not, an AssertionError is thrown.
        Parameters:
        expecteds - float array with expected values.
        actuals - float array with actual values
        maxRelDiff - the maximum relative difference that analogous array elements may have and still be considered equal.