/** * Asserts that two longs are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected long expected value. * @param actual long actual value */ public static void assertEquals(String message, long expected, long actual) { if (expected != actual) { failNotEquals(message, Long.valueOf(expected), Long.valueOf(actual)); } }
/** * Asserts that two floats are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, float expected, float actual, float delta) { if (Float.compare(expected, actual) == 0) { return; } if (!(Math.abs(expected - actual) <= delta)) { failNotEquals(message, new Float(expected), new Float(actual)); } }
/** * Asserts that two doubles are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ public static void assertEquals(String message, double expected, double actual, double delta) { if (doubleIsDifferent(expected, actual, delta)) { failNotEquals(message, Double.valueOf(expected), Double.valueOf(actual)); } }
/** * Asserts that two floats are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ public static void assertEquals(String message, float expected, float actual, float delta) { if (floatIsDifferent(expected, actual, delta)) { failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual)); } }
/** * Asserts that two doubles are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, double expected, double actual, double delta) { if (doubleIsDifferent(expected, actual, delta)) { failNotEquals(message, new Double(expected), new Double(actual)); } }
/** * Asserts that two objects are equal. If they are not, an * {@link AssertionError} is thrown with the given message. If * <code>expected</code> and <code>actual</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual actual value */ public static void assertEquals(String message, Object expected, Object actual) { if (equalsRegardingNull(expected, actual)) { return; } if (expected instanceof String && actual instanceof String) { String cleanMessage = message == null ? "" : message; throw new ComparisonFailure(cleanMessage, (String) expected, (String) actual); } else { failNotEquals(message, expected, actual); } }
/** * Asserts that two objects are equal. If they are not, an * {@link AssertionError} is thrown with the given message. If * <code>expected</code> and <code>actual</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual actual value */ static public void assertEquals(String message, Object expected, Object actual) { if (equalsRegardingNull(expected, actual)) { return; } else if (expected instanceof String && actual instanceof String) { String cleanMessage = message == null ? "" : message; throw new ComparisonFailure(cleanMessage, (String) expected, (String) actual); } else { failNotEquals(message, expected, actual); } }
/** * Asserts that two floats are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, float expected, float actual, float delta) { if (Float.compare(expected, actual) == 0) { return; } if (!(Math.abs(expected - actual) <= delta)) { failNotEquals(message, new Float(expected), new Float(actual)); } }
/** * Asserts that two doubles are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, double expected, double actual, double delta) { if (doubleIsDifferent(expected, actual, delta)) { failNotEquals(message, new Double(expected), new Double(actual)); } }
/** * Asserts that two objects are equal. If they are not, an * {@link AssertionError} is thrown with the given message. If * <code>expected</code> and <code>actual</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual actual value */ static public void assertEquals(String message, Object expected, Object actual) { if (equalsRegardingNull(expected, actual)) { return; } else if (expected instanceof String && actual instanceof String) { String cleanMessage = message == null ? "" : message; throw new ComparisonFailure(cleanMessage, (String) expected, (String) actual); } else { failNotEquals(message, expected, actual); } }
/** * Asserts that two longs are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected long expected value. * @param actual long actual value */ static public void assertEquals(String message, long expected, long actual) { if (expected != actual) { failNotEquals(message, Long.valueOf(expected), Long.valueOf(actual)); } }
/** * Asserts that two longs are equal. If they are not, an * {@link AssertionError} is thrown with the given message. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected long expected value. * @param actual long actual value */ static public void assertEquals(String message, long expected, long actual) { if (expected != actual) { failNotEquals(message, Long.valueOf(expected), Long.valueOf(actual)); } }
/** * Asserts that two doubles are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, double expected, double actual, double delta) { if (doubleIsDifferent(expected, actual, delta)) { failNotEquals(message, Double.valueOf(expected), Double.valueOf(actual)); } }
/** * Asserts that two floats are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, float expected, float actual, float delta) { if (floatIsDifferent(expected, actual, delta)) { failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual)); } }
/** * Asserts that two doubles are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, double expected, double actual, double delta) { if (doubleIsDifferent(expected, actual, delta)) { failNotEquals(message, new Double(expected), new Double(actual)); } }
/** * Asserts that two doubles are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, double expected, double actual, double delta) { if (doubleIsDifferent(expected, actual, delta)) { failNotEquals(message, new Double(expected), new Double(actual)); } }
/** * Asserts that two floats are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, float expected, float actual, float delta) { if (floatIsDifferent(expected, actual, delta)) { failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual)); } }
/** * Asserts that two doubles are equal to within a positive delta. * If they are not, an {@link AssertionError} is thrown with the given * message. If the expected value is infinity then the delta value is * ignored. NaNs are considered equal: * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual the value to check against <code>expected</code> * @param delta the maximum delta between <code>expected</code> and * <code>actual</code> for which both numbers are still * considered equal. */ static public void assertEquals(String message, double expected, double actual, double delta) { if (doubleIsDifferent(expected, actual, delta)) { failNotEquals(message, Double.valueOf(expected), Double.valueOf(actual)); } }
/** * Asserts that two objects are equal. If they are not, an * {@link AssertionError} is thrown with the given message. If * <code>expected</code> and <code>actual</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual actual value */ static public void assertEquals(String message, Object expected, Object actual) { if (equalsRegardingNull(expected, actual)) { return; } else if (expected instanceof String && actual instanceof String) { String cleanMessage = message == null ? "" : message; throw new ComparisonFailure(cleanMessage, (String) expected, (String) actual); } else { failNotEquals(message, expected, actual); } }
/** * Asserts that two objects are equal. If they are not, an * {@link AssertionError} is thrown with the given message. If * <code>expected</code> and <code>actual</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param expected expected value * @param actual actual value */ static public void assertEquals(String message, Object expected, Object actual) { if (equalsRegardingNull(expected, actual)) { return; } else if (expected instanceof String && actual instanceof String) { String cleanMessage = message == null ? "" : message; throw new ComparisonFailure(cleanMessage, (String) expected, (String) actual); } else { failNotEquals(message, expected, actual); } }