Today I saw a JUnit test case with a java assertion instead of the JUnit assertions—Are there significant advantages or disadvantages to prefer one over the other?
When a test fails you get more infomation.
assertEquals(1, 2); results in java.lang.AssertionError: expected:<1> but was:<2>
assertEquals(1, 2);
java.lang.AssertionError: expected:<1> but was:<2>
vs
assert(1 == 2); results in java.lang.AssertionError
assert(1 == 2);
java.lang.AssertionError
you can get even more info if you add the message argument to assertEquals
assertEquals