Using Assume.assumeTrue or Assert.assertTrue, when do tests exit?

Viewed 2151

I am using JUnit 4.12 and this is my current understanding of the following APIs I use frequently:

  • assumeTrue: if expression evaluates to false, test will halt and be ignored
  • assertTrue: if condition is false, throws an AssertionError
  • assertEquals: if they are not equal, an AssertionError is thrown with the given message
  • assertNotNull: if it is null, throws an AssertionError

However, I am unable to get clarity on couple of things:

  1. my understanding is that only for assumeTrue, the tests will exit but the very definition of assert is that the program should exit when the statement evaluates to false
  2. when the test throws an AssertionError, does it exit the test case or continue executing the remaining steps?
  3. can the tests be considered pass, even if they throw an AssertionError or are the tests considered fail?
1 Answers
Related