List of utility methods to do Assert Equal
void | assertEquals(double x, double y) assert Equals assertEquals(x, y, 1e-10); |
void | assertEquals(final int expected, final int actual) assert Equals if (expected != actual) { throw new AssertionError("expected <" + expected + ">, but was <" + actual + ">"); |
void | assertEquals(final Object actual, final Object expected, final String name) Asserts that two parameters have the same value. if (actual == null) { if (expected != null) { throw new IllegalArgumentException(PREFIX + name + " is not equals the expected one."); } else { if (!actual.equals(expected)) { throw new IllegalArgumentException(PREFIX + name + " is not equals the expected one."); |
void | assertEquals(float a1, float a2) Ensure that the two values given are equal, if not fail the test if (a1 != a2) { throw new RuntimeException("TEST FAILS: " + a1 + " should be " + a2); |
void | assertEquals(int a, int b) assert Equals if (a != b) { fail("assertionFailed"); |
void | assertEquals(int i1, int i2) Throws a runtime exception if i1 != i2. if (i1 != i2) { throw new RuntimeException("assert " + i1 + " == " + i2); |
void | assertEquals(Integer a, Integer b) assert Equals if (!a.equals(b)) throw new AssertionError(); |
void | assertEquals(Object a, Object b, String msg) assert Equals if (a == b) { return; if (a != null && a.equals(b)) { return; throw new AssertionError(msg + " expecting: " + b + " actual: " + a); |
void | assertEquals(Object exp, Object actual) assert Equals if (!(exp.equals(actual))) { throw new Exception("Expected #" + exp + "# but was #" + actual + "#"); |
void | assertEquals(Object expected, Object actual) assert Equals assertEquals(null, expected, actual); |