I use JUnit 4.12, and this is my real understanding of the following APIs that I often use:
- acceptTrue: if the expression evaluates to false, the test will stop and be ignored
- assertTrue: if the condition is false, throws an AssertionError
- assertEquals: if they are not equal, AssertionError is thrown with this message
- assertNotNull: if it is NULL, throws an AssertionError
However, I cannot get clarity regarding a few things:
- My understanding is that only acceptTrue tests will complete, but the assert definition itself is that the program should exit when the statement evaluates to false
- when the test throws an AssertionError, does it exit the test case or continue with the remaining steps?
- Can tests be considered passed even if they throw an AssertionError or are the tests considered unsuccessful?
source
share