/** * Asserts that two objects are <b>not</b> equals. If they are, an * {@link AssertionError} is thrown with the given message. If * <code>unexpected</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 unexpected unexpected value to check * @param actual the value to check against <code>unexpected</code> */ public static void assertNotEquals(String message, Object unexpected, Object actual) { if (equalsRegardingNull(unexpected, actual)) { failEquals(message, actual); } }
/** * Asserts that two objects are <b>not</b> equals. If they are, an * {@link AssertionError} is thrown with the given message. If * <code>first</code> and <code>second</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param first first value to check * @param second the value to check against <code>first</code> */ static public void assertNotEquals(String message, Object first, Object second) { if (equalsRegardingNull(first, second)) { failEquals(message, first); } }
static String format(String message, Object expected, Object actual) { String formatted = ""; if (message != null && !"".equals(message)) { formatted = message + " "; } String expectedString = String.valueOf(expected); String actualString = String.valueOf(actual); if (equalsRegardingNull(expectedString, actualString)) { return formatted + "expected: " + formatClassAndValue(expected, expectedString) + " but was: " + formatClassAndValue(actual, actualString); } else { return formatted + "expected:<" + expectedString + "> but was:<" + actualString + ">"; } }
/** * 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 */ 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 <b>not</b> equals. If they are, an * {@link AssertionError} is thrown with the given message. If * <code>first</code> and <code>second</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param first first value to check * @param second the value to check against <code>first</code> */ static public void assertNotEquals(String message, Object first, Object second) { if (equalsRegardingNull(first, second)) { failEquals(message, first); } }
/** * 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 <b>not</b> equals. If they are, an * {@link AssertionError} is thrown with the given message. If * <code>unexpected</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 unexpected unexpected value to check * @param actual the value to check against <code>unexpected</code> */ static public void assertNotEquals(String message, Object unexpected, Object actual) { if (equalsRegardingNull(unexpected, actual)) { failEquals(message, actual); } }
/** * Asserts that two objects are <b>not</b> equals. If they are, an * {@link AssertionError} is thrown with the given message. If * <code>first</code> and <code>second</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param first first value to check * @param second the value to check against <code>first</code> */ static public void assertNotEquals(String message, Object first, Object second) { if (equalsRegardingNull(first, second)) { failEquals(message, first); } }
/** * Asserts that two objects are <b>not</b> equals. If they are, an * {@link AssertionError} is thrown with the given message. If * <code>unexpected</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 unexpected unexpected value to check * @param actual the value to check against <code>unexpected</code> */ static public void assertNotEquals(String message, Object unexpected, Object actual) { if (equalsRegardingNull(unexpected, actual)) { failEquals(message, actual); } }
/** * Asserts that two objects are <b>not</b> equals. If they are, an * {@link AssertionError} is thrown with the given message. If * <code>first</code> and <code>second</code> are <code>null</code>, * they are considered equal. * * @param message the identifying message for the {@link AssertionError} (<code>null</code> * okay) * @param first first value to check * @param second the value to check against <code>first</code> */ static public void assertNotEquals(String message, Object first, Object second) { if (equalsRegardingNull(first, second)) { failEquals(message, first); } }
/** * 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); } }
/** * 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); } }