Class Assert<E>

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Assert.CmpObj
      Represents an ordering relation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String STR_ASTOP  
      private static java.lang.String STR_BUTWAS  
      private static java.lang.String STR_DN_PROV  
      private static java.lang.String STR_IN_ABS_VAL  
      private static java.lang.String STR_OBJECT  
      private static java.lang.String STR_RAISED  
    • Constructor Summary

      Constructors 
      Constructor Description
      Assert()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void assertAbsEquals​(double expected, double actual, double absdev)
      Fails if the absolute deviation between expected and actual exceeds absdiv in absolute value.
      static void assertAbsEquals​(java.lang.String message, double expected, double actual, double absdev)
      Fails if the absolute deviation between expected and actual exceeds absdiv in absolute value.
      static void assertAbsRelEquals​(double expected, double separateAbsRel, double actual, double absdev, double reldev)
      For expected<= separateAbsRel behaves like Assert.assertEquals(String,double,double,double) ignoring reldev, whereas otherwise behaves like Assert.assertEquals(String, double, double, double) ignoring absdev.
      static void assertAbsRelEquals​(java.lang.String message, double expected, double separateAbsRel, double actual, double absdev, double reldev)
      For expected<= separateAbsRel behaves like Assert.assertEquals(String,double,double,double) ignoring reldev, whereas otherwise behaves like Assert.assertEquals(String, double, double, double) ignoring absdev.
      static void assertArraysEquals​(java.lang.Object expected, java.lang.Object actual)  
      static void assertArraysEquals​(java.lang.Object expected, java.lang.Object actual, double delta)
      Is a deep version of method junit.framework.Assert.assertEquals(Object, Object) for arrays: checks whether the two arguments are arrays and whether they are arrays, recursively whether the lengths coincide and if the entries do so.
      static void assertArraysEquals​(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
      Is a deep version of method junit.framework.Assert.assertEquals(Object, Object) for arrays: checks whether the two arguments are arrays and whether they are arrays, recursively whether the lengths coincide and if the entries do so.
      static void assertEquals​(java.lang.Object expected, java.lang.Object actual)
      Fails for !
      static void assertEquals​(java.lang.String message, java.lang.Object expected, java.lang.Object actual)  
      static <E> void assertIs​(Assert.CmpObj cmpObj, E expected, E actual, java.util.Comparator<E> cmp)
      Fails if cmp.compare(expected, actual) is not as expected and raises an exception if this expression cannot be evaluated.
      static <E> void assertIs​(Assert.CmpObj cmpObj, java.lang.Comparable<E> expected, E actual)
      Fails if expected.compareTo(actual) is not as expected and raises an exception if this expression cannot be evaluated.
      static <E> void assertIs​(Assert.CmpObj cmpObj, java.lang.String message, E expected, E actual, java.util.Comparator<E> cmp)
      Fails if cmp.compare(expected, actual) is not as expected and raises an exception if this expression cannot be evaluated.
      static <E> void assertIs​(Assert.CmpObj cmpObj, java.lang.String message, java.lang.Comparable<E> expected, E actual)
      Fails if expected.compareTo(actual) is not as expected and raises an exception if this expression cannot be evaluated.
      static <E> void assertIsContainedAll​(java.util.Collection<E> expected, java.util.Collection<E> actual)
      Fails if actual is not a subcollection of expected.
      static <E> void assertIsIn​(java.util.Collection<E> expectedContainer, java.lang.Object actualElement)
      Fails if actualElement is not an element of expectedContainer.
      static void assertNormAbsEquals​(java.lang.Object expected, java.lang.Object actual, java.lang.String norm, double delta)  
      static void assertNormAbsEquals​(java.lang.String message, java.lang.Object expected, java.lang.Object actual, java.lang.String norm, double delta)
      Fails if actual is null or actual deviates from expected by at least delta, provided the test can be executed at all.
      static void assertNormRelEquals​(java.lang.Object expected, java.lang.Object actual, java.lang.String norm, double reldev)
      Fails if actual is null or actual deviates from expected by at least delta, provided the test can be executed at all.
      static void assertNormRelEquals​(java.lang.String message, java.lang.Object expected, java.lang.Object actual, java.lang.String norm, double reldev)  
      private static void assertRecArraysEquals​(java.lang.Object expected, java.lang.Object actual, int[] indices)
      Is a deep version of method junit.framework.Assert.assertEquals(Object, Object) for arrays: checks recursively whether the lengths coincide and if the entries do so.
      private static void assertRecArraysEquals​(java.lang.Object expected, java.lang.Object actual, int[] indices, double delta)
      Is a deep version of method junit.framework.Assert.assertEquals(Object, Object) for arrays: checks recursively whether the lengths coincide and if the entries do so.
      static void assertRelEquals​(double expected, double actual, double reldev)
      Fails reporting a standard message if the relative deviation between expected and actual exceeds reldiv in absolute value.
      static void assertRelEquals​(java.lang.String message, double expected, double actual, double reldev)
      Fails if the relative deviation between expected and actual exceeds reldiv in absolute value.
      static void assertStringEquals​(java.lang.String expected, java.lang.String actual)
      Special case of assertEquals(Object, Object) which provides an error message specifying the common prefix of expected with actual.
      private static void checkArraysSameClass​(java.lang.Object expected, java.lang.Object actual)
      Checks whether expected is an array and whether its type coincides with the type of actual.
      private static boolean checkNulls​(java.lang.String message, java.lang.Object expected, java.lang.Object actual)
      Throws an error if exactly one of the parameters are null and otherwise returns whether both are null.
      private static void checkNullsB​(java.lang.String norm, java.lang.Object expected, java.lang.Object actual)
      Fails if the test can be executed, i.e.
      private static double computeNorm1​(java.lang.String norm, java.lang.Object expected)
      Returns the norm of expected defined by the method named norm.
      private static double computeNorm2​(java.lang.String norm, java.lang.Object expected, java.lang.Object actual)
      Returns the distance of the two objects expected and actual defined by the metric defined by the method named norm; typically something like the norm of a kind of difference.
      private static java.lang.String expectedActual​(java.lang.Object expected, java.lang.Object actual)  
      private static java.lang.String failInd​(int[] indices)  
      private static java.lang.String failLengthMessage​(java.lang.Object expectedEntry, java.lang.Object actualEntry, int[] indices)  
      private static java.lang.String failMessage​(java.lang.Object expectedEntry, java.lang.Object actualEntry, int[] indices)  
      private static java.lang.String failMessageDelta​(double expectedEntry, double actualEntry, int[] indices, double delta)
      Returns a failure message indicating that in comparing nested arrays of final float type as double[][], the corresponding entries given by index path indices deviate at least delta.
      private static java.lang.String failMessageLength​(int expectedLen, int actualLen, int[] indices)  
      private static <E> int invokeCompare​(E obj1, E obj2, java.util.Comparator<E> cmp)
      Returns cmp.compare(expected, actual) if possible.
      static double test()  
      static boolean testAbsEquals​(double expected, double actual, double absdev)
      Returns whether the absolute deviation between expected and actual exceeds absdiv in absolute value.
      static boolean testRelEquals​(double expected, double actual, double reldev)
      Returns whether the relative deviation between expected and actual exceeds reldiv in absolute value.
      private static void thrwAccessible​(java.lang.reflect.Method method)  
      private static void thrwWrongArgs​(java.lang.reflect.Method method)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Assert

        public Assert()
    • Method Detail

      • thrwAccessible

        private static void thrwAccessible​(java.lang.reflect.Method method)
      • thrwWrongArgs

        private static void thrwWrongArgs​(java.lang.reflect.Method method)
      • computeNorm2

        private static double computeNorm2​(java.lang.String norm,
                                           java.lang.Object expected,
                                           java.lang.Object actual)
        Returns the distance of the two objects expected and actual defined by the metric defined by the method named norm; typically something like the norm of a kind of difference.

        CAUTION: This method shall be designed to compute values close to zero, i.e. is applied to actual cloase to expected. This must be reflected in the definition of the method given by norm.

        Parameters:
        norm - the non-null name of a metric method, i.e. of a member method of the form public double norm(other) with the properties of a metric:
        • x.norm(x) yields 0
        • x.norm(y) and y.norm(x) yield the same result,
        • x.norm(y)+y.norm(z)\(\ge\) x.norm(z).
        CAUTION: This method must be designed to be applied to actual close to expected i.e. with a lot of extinction. For certain arithmetic types, this requires care to obtain reasonable performance.
        Throws:
        java.lang.IllegalArgumentException - if the test cannot be performed, i.e.
        • norm does not represent a metric method, i.e. a member method of the form public double norm(other). Of course, the properties of a metric cannot be proved.
        • invoking expected.norm(actual) raises an exception
        See Also:
        assertNormAbsEquals(String, Object, Object, String, double), assertNormRelEquals(String, Object, Object, String, double), computeNorm1(String, Object)
      • assertNormAbsEquals

        public static void assertNormAbsEquals​(java.lang.String message,
                                               java.lang.Object expected,
                                               java.lang.Object actual,
                                               java.lang.String norm,
                                               double delta)
        Fails if actual is null or actual deviates from expected by at least delta, provided the test can be executed at all. The deviation is computed with respect to the metric given by expected.norm(actual) which is assumed to have signature double norm(Cls actual) with Cls the class of expected.
        Parameters:
        message - the error message displayed if the test fails regularly, i.e. if computeNorm2(norm, expected, actual) can be evaluated without throwing an exception.
        expected - The expected object (see the actual object).
        actual - The actual object which is expected to deviate from expected by at most delta in norm
        norm - the name of a metric method, i.e. of a member method of the form public double norm(other) with the properties of a metric:
        • x.norm(x) yields 0
        • x.norm(y) and y.norm(x) yield the same result,
        • x.norm(y)+y.norm(z)\(\ge\) x.norm(z).
        delta - the allowed deviation as a double value.
        Throws:
        java.lang.IllegalArgumentException - if the test cannot be performed, i.e.
        • norm is null or does not represent a metric method, i.e. a member method of the form public double norm(other). Of course, the properties of a metric cannot be proved.
        • invoking expected.norm(actual) raises an exception
        java.lang.IllegalArgumentException - if expected==null.
        junit.framework.AssertionFailedError - if the test can be performed, i.e. no IllegalArgumentException is thrown but
        • actual==null or
        • the distance returned by the metric exceeds delta.
      • assertNormAbsEquals

        public static void assertNormAbsEquals​(java.lang.Object expected,
                                               java.lang.Object actual,
                                               java.lang.String norm,
                                               double delta)
      • computeNorm1

        private static double computeNorm1​(java.lang.String norm,
                                           java.lang.Object expected)
        Returns the norm of expected defined by the method named norm.
        Parameters:
        norm - the non-null name of a norm method, i.e. of a member method of the form public double norm() with the properties of a norm:
        • x.norm() yields 0 iff x represents the zero vector.
        • (sx).norm()=s(x.norm()) where sx and s(...) represent scalar multiplication.
        • x.norm()+y.norm()\(\ge (x+y)\).norm(z), where \(x+y\) represents the sum of vectors.
        expected - The object from which the norm is to be computed.
        Returns:
        the norm of expected defined by the method named norm.
        Throws:
        java.lang.IllegalArgumentException - if the test cannot be performed, i.e.
        • norm does not represent a norm method, i.e. a member method of the form public double norm(other). Of course, the properties of a norm cannot be proved.
        • invoking expected.norm() raises an exception
      • assertNormRelEquals

        public static void assertNormRelEquals​(java.lang.Object expected,
                                               java.lang.Object actual,
                                               java.lang.String norm,
                                               double reldev)
        Fails if actual is null or actual deviates from expected by at least delta, provided the test can be executed at all.
      • assertNormRelEquals

        public static void assertNormRelEquals​(java.lang.String message,
                                               java.lang.Object expected,
                                               java.lang.Object actual,
                                               java.lang.String norm,
                                               double reldev)
      • expectedActual

        private static java.lang.String expectedActual​(java.lang.Object expected,
                                                       java.lang.Object actual)
      • assertEquals

        public static void assertEquals​(java.lang.Object expected,
                                        java.lang.Object actual)
        Fails for !expected.equals(actual) and raises an exception if this expression cannot be evaluated.
        Parameters:
        expected - an instance of an Object.
        actual - an Object or null.
        Throws:
        java.lang.IllegalArgumentException -
        • for expected == null,
        • if invoking expected.equals(actual) raises an exception.
        junit.framework.AssertionFailedError - for !expected.equals(actual).
      • assertEquals

        public static void assertEquals​(java.lang.String message,
                                        java.lang.Object expected,
                                        java.lang.Object actual)
      • assertIsIn

        public static <E> void assertIsIn​(java.util.Collection<E> expectedContainer,
                                          java.lang.Object actualElement)
        Fails if actualElement is not an element of expectedContainer.
        Parameters:
        expectedContainer - a Collection the object actualElement is expected to be contained in.
        actualElement - an instance of an Object.
        Throws:
        junit.framework.AssertionFailedError - if actualElement is not in expectedContainer and in particular if it is null.
      • assertIsContainedAll

        public static <E> void assertIsContainedAll​(java.util.Collection<E> expected,
                                                    java.util.Collection<E> actual)
        Fails if actual is not a subcollection of expected.
        Parameters:
        expected - a Collection
        actual - another Collection
        Throws:
        junit.framework.AssertionFailedError - if actual is not a subcollection of expectedContainer. This includes the cases where a parameter is null.
      • assertIs

        public static <E> void assertIs​(Assert.CmpObj cmpObj,
                                        java.lang.String message,
                                        java.lang.Comparable<E> expected,
                                        E actual)
        Fails if expected.compareTo(actual) is not as expected and raises an exception if this expression cannot be evaluated.
        Parameters:
        message - the error message displayed if the test fails regularly, i.e. if expected.compareTo(actual) can be evaluated without throwing an exception.
        cmpObj - The action that decides whether the relation is satisfied.
        expected - an instance of a Comparable.
        actual - an Object or null. Actually this should be a Comparable as well.
        Throws:
        java.lang.IllegalArgumentException - if invoking expected.compareTo(actual) raises an exception. In particular for expected == null
        java.lang.IllegalStateException - if expected.compare(actual) is evaluated for actual == null without throwing an exception as specified for Comparable.compareTo(T).
        junit.framework.AssertionFailedError - if the value of expected.compareTo(actual) is not as specified by cmpObj.
        See Also:
        assertIs(CmpObj, Comparable, Object)
      • assertIs

        public static <E> void assertIs​(Assert.CmpObj cmpObj,
                                        java.lang.String message,
                                        E expected,
                                        E actual,
                                        java.util.Comparator<E> cmp)
        Fails if cmp.compare(expected, actual) is not as expected and raises an exception if this expression cannot be evaluated.
        Parameters:
        message - the error message displayed if the test fails regularly, i.e. if cmp.compare(expected, actual) can be evaluated without throwing an exception.
        cmpObj - The action that decides whether the relation is satisfied.
        expected - an Object.
        actual - another Object.
        Throws:
        java.lang.IllegalArgumentException - if invoking cmp.compare(expected, actual) raises an exception.
        junit.framework.AssertionFailedError - if the value of cmp.compare(expected, actual) is not as specified by cmpObj.
        See Also:
        assertIs(CmpObj, Object, Object, Comparator)
      • assertIs

        public static <E> void assertIs​(Assert.CmpObj cmpObj,
                                        java.lang.Comparable<E> expected,
                                        E actual)
        Fails if expected.compareTo(actual) is not as expected and raises an exception if this expression cannot be evaluated.
        Parameters:
        cmpObj - The action that decides whether the relation is satisfied.
        expected - an instance of a Comparable.
        actual - an Object or null. Actually this should be a Comparable as well.
        Throws:
        java.lang.IllegalArgumentException - if invoking expected.compareTo(actual) raises an exception. In particular for expected == null
        java.lang.IllegalStateException - if expected.compare(actual) is evaluated for actual == null without throwing an exception as specified for Comparable.compareTo(T).
        junit.framework.AssertionFailedError - if the value of expected.compareTo(actual) is not as specified by cmpObj.
        See Also:
        assertIs(CmpObj, String, Comparable, Object)
      • assertIs

        public static <E> void assertIs​(Assert.CmpObj cmpObj,
                                        E expected,
                                        E actual,
                                        java.util.Comparator<E> cmp)
        Fails if cmp.compare(expected, actual) is not as expected and raises an exception if this expression cannot be evaluated.
        Parameters:
        cmpObj - The action that decides whether the relation is satisfied.
        expected - an Object.
        actual - another Object.
        Throws:
        java.lang.IllegalArgumentException - if invoking cmp.compare(expected, actual) raises an exception.
        junit.framework.AssertionFailedError - if the value of cmp.compare(expected, actual) is not as specified by cmpObj.
        See Also:
        assertIs(CmpObj, String, Object, Object, Comparator)
      • invokeCompare

        private static <E> int invokeCompare​(E obj1,
                                             E obj2,
                                             java.util.Comparator<E> cmp)
        Returns cmp.compare(expected, actual) if possible.
        Parameters:
        obj1 - an Object.
        obj2 - another Object.
        cmp - a comparator which is capable of comparing obj1 with obj2.
        Returns:
        the int value which results in invoking cmp.compare(expected, actual).
        Throws:
        java.lang.IllegalArgumentException -
        • for cmp == null,
        • if invoking cmp.compare(expected, actual) raises an exception.
      • checkNulls

        private static boolean checkNulls​(java.lang.String message,
                                          java.lang.Object expected,
                                          java.lang.Object actual)
        Throws an error if exactly one of the parameters are null and otherwise returns whether both are null.
        Parameters:
        message - the error message used in case the assertion fails.
        expected - an Object.
        actual - another Object.
        Returns:
        whether both are null, if either both, expected and actual are null.
        Throws:
        junit.framework.AssertionFailedError - if exactly one of the parameters are null.
      • assertArraysEquals

        public static void assertArraysEquals​(java.lang.String message,
                                              java.lang.Object expected,
                                              java.lang.Object actual)
        Is a deep version of method junit.framework.Assert.assertEquals(Object, Object) for arrays: checks
        • whether the two arguments are arrays and whether they are arrays,
        • recursively whether the lengths coincide and if the entries do so.
        Parameters:
        message - the error message used in case the assertion fails.
        expected - an array.
        actual - an array.
        Throws:
        java.lang.IllegalArgumentException - if expected is not an array.
        junit.framework.AssertionFailedError - if the types of the two arguments do not coincide (e.g. because the second one is not an array). See also assertRecArraysEquals(java.lang.Object, java.lang.Object, int[]).
        junit.framework.AssertionFailedError - if the the two arrays do not coincide in their lenght or in some entry.
      • assertArraysEquals

        public static void assertArraysEquals​(java.lang.Object expected,
                                              java.lang.Object actual)
      • checkArraysSameClass

        private static void checkArraysSameClass​(java.lang.Object expected,
                                                 java.lang.Object actual)
        Checks whether expected is an array and whether its type coincides with the type of actual. If not an exception is thrown. Invokes Assert.fail(java.lang.String) if the types of expected and of actual do not coincide.
        Parameters:
        expected - the expected array.
        actual - the actual array.
        Throws:
        java.lang.IllegalArgumentException - if expected is not an array.
      • assertRecArraysEquals

        private static void assertRecArraysEquals​(java.lang.Object expected,
                                                  java.lang.Object actual,
                                                  int[] indices)
        Is a deep version of method junit.framework.Assert.assertEquals(Object, Object) for arrays: checks recursively whether the lengths coincide and if the entries do so. Contract: the classes of the two arguments coincide and both are arrays.
        Parameters:
        expected - the expected array.
        actual - the actual array.
        indices - contains the list of indices of the arrays expected and actual within the arrays comprising them. The recursion starts with indices = new int[] {}.
        Throws:
        junit.framework.AssertionFailedError - if the the two arrays do not coincide in their lenght or in some entry.
      • failInd

        private static java.lang.String failInd​(int[] indices)
      • failLengthMessage

        private static java.lang.String failLengthMessage​(java.lang.Object expectedEntry,
                                                          java.lang.Object actualEntry,
                                                          int[] indices)
      • failMessage

        private static java.lang.String failMessage​(java.lang.Object expectedEntry,
                                                    java.lang.Object actualEntry,
                                                    int[] indices)
      • failMessageDelta

        private static java.lang.String failMessageDelta​(double expectedEntry,
                                                         double actualEntry,
                                                         int[] indices,
                                                         double delta)
        Returns a failure message indicating that in comparing nested arrays of final float type as double[][], the corresponding entries given by index path indices deviate at least delta.
      • failMessageLength

        private static java.lang.String failMessageLength​(int expectedLen,
                                                          int actualLen,
                                                          int[] indices)
      • assertArraysEquals

        public static void assertArraysEquals​(java.lang.Object expected,
                                              java.lang.Object actual,
                                              double delta)
        Is a deep version of method junit.framework.Assert.assertEquals(Object, Object) for arrays: checks
        • whether the two arguments are arrays and whether they are arrays,
        • recursively whether the lengths coincide and if the entries do so.
        Parameters:
        expected - the expected array.
        actual - the actual array which is assumed to be of same type as expected.
        delta - the allowed deviation as a double value.
        Throws:
        java.lang.IllegalArgumentException - if expected is not an array.
        junit.framework.AssertionFailedError - if the types of the two arguments do not coincide (e.g. because the second one is not an array). See also assertRecArraysEquals(java.lang.Object, java.lang.Object, int[]).
        junit.framework.AssertionFailedError - if the the two arrays do not coincide in their lenght or in some entry.
      • assertRecArraysEquals

        private static void assertRecArraysEquals​(java.lang.Object expected,
                                                  java.lang.Object actual,
                                                  int[] indices,
                                                  double delta)
        Is a deep version of method junit.framework.Assert.assertEquals(Object, Object) for arrays: checks recursively whether the lengths coincide and if the entries do so. Contract: the classes of the two arguments coincide and both are arrays.
        Parameters:
        expected - the expected array.
        actual - the actual array which is assumed to be of same type as expected.
        indices - contains the list of indices of the arrays expected and actual within the arrays comprising them. The recursion starts with indices = new int[] {}. This is for generating an appropriate message for an AssertionFailedError.
        delta - the allowed deviation as a double value.
        Throws:
        java.lang.IllegalArgumentException - if expected or actual is not an array.
        junit.framework.AssertionFailedError - if the the two arrays do not coincide in their length or in some entry.
        eu.simuline.util.NotYetImplementedException - if expected is not 'finally' of primitive type.
      • testRelEquals

        public static boolean testRelEquals​(double expected,
                                            double actual,
                                            double reldev)
        Returns whether the relative deviation between expected and actual exceeds reldiv in absolute value.
        Parameters:
        expected - the double value expected. This may be neither 0.0, nor an infinite value nor NaN.
        actual - the actual double value.
        reldev - the maximum relative deviation between expected and actual. This must be a non-negative value; in particular, NaN is not allowed.
        Returns:
        whether the relative deviation between expected and actual exceeds reldiv in absolute value.
        Throws:
        java.lang.IllegalArgumentException -
        • if expected is either 0.0, infinite or NaN.
        • if reldev is negative or NaN.
        See Also:
        assertRelEquals(String, double, double, double)
      • assertRelEquals

        public static void assertRelEquals​(java.lang.String message,
                                           double expected,
                                           double actual,
                                           double reldev)
        Fails if the relative deviation between expected and actual exceeds reldiv in absolute value.
        Parameters:
        message - the error message used in case the assertion fails.
        expected - the double value expected. This may be neither 0.0, nor an infinite value nor NaN.
        actual - the actual double value.
        reldev - the maximum relative deviation between expected and actual. This must be a non-negative value; in particular, NaN is not allowed.
        Throws:
        java.lang.IllegalArgumentException -
        • if expected is either 0.0, infinite or NaN.
        • if reldev is negative or NaN.
        See Also:
        assertRelEquals(double, double, double), testRelEquals(double, double, double)
      • assertRelEquals

        public static void assertRelEquals​(double expected,
                                           double actual,
                                           double reldev)
        Fails reporting a standard message if the relative deviation between expected and actual exceeds reldiv in absolute value.
        Parameters:
        expected - the double value expected. This may be neither 0.0, nor an infinite value nor NaN.
        actual - the actual double value.
        reldev - the maximum relative deviation between expected and actual. This must be a non-negative value; in particular, NaN is not allowed.
        Throws:
        java.lang.IllegalArgumentException -
        • if expected is either 0.0, infinite or NaN.
        • if reldev is negative or NaN.
        See Also:
        assertRelEquals(String, double, double, double)
      • assertAbsRelEquals

        public static void assertAbsRelEquals​(java.lang.String message,
                                              double expected,
                                              double separateAbsRel,
                                              double actual,
                                              double absdev,
                                              double reldev)
        For expected<= separateAbsRel behaves like Assert.assertEquals(String,double,double,double) ignoring reldev, whereas otherwise behaves like Assert.assertEquals(String, double, double, double) ignoring absdev.
        Parameters:
        message - the error message used in case the assertion fails.
        expected - the double value expected.
        separateAbsRel - a non-negative double value separating the two parts of the domain of this method.
        actual - the actual double value.
        absdev - the maximum absolute deviation between expected and actual. This is relevant for expected<= separateAbsRel but ignored otherwise.
        reldev - the maximum relative deviation between expected and actual. This is relevant for expected > separateAbsRel but ignored otherwise.
        Throws:
        java.lang.IllegalArgumentException - for separateAbsRel < 0.
      • assertAbsRelEquals

        public static void assertAbsRelEquals​(double expected,
                                              double separateAbsRel,
                                              double actual,
                                              double absdev,
                                              double reldev)
        For expected<= separateAbsRel behaves like Assert.assertEquals(String,double,double,double) ignoring reldev, whereas otherwise behaves like Assert.assertEquals(String, double, double, double) ignoring absdev.
        Parameters:
        expected - the double value expected.
        separateAbsRel - a non-negative double value separating the two parts of the domain of this method.
        actual - the actual double value.
        absdev - the maximum absolute deviation between expected and actual. This is relevant for expected<= separateAbsRel but ignored otherwise.
        reldev - the maximum relative deviation between expected and actual. This is relevant for expected > separateAbsRel but ignored otherwise.
        Throws:
        java.lang.IllegalArgumentException - for separateAbsRel < 0.
      • testAbsEquals

        public static boolean testAbsEquals​(double expected,
                                            double actual,
                                            double absdev)
        Returns whether the absolute deviation between expected and actual exceeds absdiv in absolute value.
        Parameters:
        expected - the double value expected. This may not be NaN.
        actual - the actual double value.
        absdev - the maximum absolute deviation between expected and actual. This must be a non-negative value; in particular, NaN is not allowed.
        Returns:
        whether the absolute deviation between expected and actual exceeds absdiv in absolute value.
        Throws:
        java.lang.IllegalArgumentException -
        • if expected is NaN.
        • if absdev is negative or NaN.
        See Also:
        assertAbsEquals(String, double, double, double)
      • assertAbsEquals

        public static void assertAbsEquals​(java.lang.String message,
                                           double expected,
                                           double actual,
                                           double absdev)
        Fails if the absolute deviation between expected and actual exceeds absdiv in absolute value.
        Parameters:
        message - the error message used in case the assertion fails.
        expected - the double value expected. This may not be neither NaN.
        actual - the actual double value.
        absdev - the maximum absolute deviation between expected and actual. This must be a non-negative value; in particular, NaN is not allowed.
        Throws:
        java.lang.IllegalArgumentException -
        • if expected is NaN.
        • if absdev is negative or NaN.
        See Also:
        assertAbsEquals(double, double, double), testAbsEquals(double, double, double)
      • assertAbsEquals

        public static void assertAbsEquals​(double expected,
                                           double actual,
                                           double absdev)
        Fails if the absolute deviation between expected and actual exceeds absdiv in absolute value.
        Parameters:
        expected - the double value expected. This may not be neither NaN.
        actual - the actual double value.
        absdev - the maximum absolute deviation between expected and actual. This must be a non-negative value; in particular, NaN is not allowed.
        Throws:
        java.lang.IllegalArgumentException -
        • if expected is NaN.
        • if absdev is negative or NaN.
        See Also:
        assertAbsEquals(String, double, double, double)
      • assertStringEquals

        public static void assertStringEquals​(java.lang.String expected,
                                              java.lang.String actual)
        Special case of assertEquals(Object, Object) which provides an error message specifying the common prefix of expected with actual. This is suitable for keeping long strings under control. If one of the arguments is null, this method behaves like Assert.assertEquals(Object, Object).
        Parameters:
        expected - the String expected. This ma
        actual - a String value
      • test

        public static double test()