Class DoubleSubject

    • Method Detail

      • isEqualTo

        public void isEqualTo​(@Nullable Object expected)
        Asserts that the actual value is exactly equal to the given value, with equality defined as by Double.equals(java.lang.Object). This method is not recommended when the code under test is doing any kind of arithmetic: use isWithin(double) with a suitable tolerance in that case. (Remember that the exact result of floating point arithmetic is sensitive to apparently trivial changes such as replacing (a + b) + c with a + (b + c).) This method is recommended when the code under test is specified as either copying a value without modification from its input or returning a well-defined literal or constant value.

        Note: The assertion isEqualTo(0.0) fails for an input of -0.0, and vice versa. For an assertion that passes for either 0.0 or -0.0, use isZero().

        Overrides:
        isEqualTo in class Subject
      • isNotEqualTo

        public void isNotEqualTo​(@Nullable Object other)
        Asserts that the actual value is not exactly equal to the given value, with equality defined as by {link Double#equals}. See isEqualTo(java.lang.Object) for advice on when exact equality is recommended. Use isNotWithin(double) for an assertion with a tolerance.

        Note: The assertion isNotEqualTo(0.0) passes for -0.0, and vice versa. For an assertion that fails for either 0.0 or -0.0, use isNonZero().

        Overrides:
        isNotEqualTo in class Subject
      • isZero

        public void isZero()
        Asserts that the actual value is zero (i.e. it is either 0.0 or -0.0).
      • isNonZero

        public void isNonZero()
        Asserts that the actual value is a non-null value other than zero (i.e. it is not 0.0, -0.0 or null).
      • isNaN

        public void isNaN()
        Asserts that the actual value is Double.NaN.
      • isGreaterThan

        public void isGreaterThan​(int other)
        Checks that the actual value is greater than other.

        To check that the actual value is greater than or equal to other, use isAtLeast(int).

      • isLessThan

        public void isLessThan​(int other)
        Checks that the actual value is less than other.

        To check that the actual value is less than or equal to other, use isAtMost(int) .

      • isAtMost

        public void isAtMost​(int other)
        Checks that the actual value is less than or equal to other.

        To check that the actual value is strictly less than other, use isLessThan(int).

      • isAtLeast

        public void isAtLeast​(int other)
        Checks that the actual value is greater than or equal to other.

        To check that the actual value is strictly greater than other, use isGreaterThan(int).