From the course: Java: Testing with JUnit

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Assumptions

Assumptions

- [Instructor] Assumptions are a way of setting conditions for executing a test. If we meet the assumption, the test will get executed. If we don't meet the assumption, the test won't be executed. Assumptions are in a class in the org.junit.jupiter.api package. This class contains methods that will test assumptions. The main difference between assertions and assumptions is that a failed assumption does not lead to a failed test but to an aborted test instead. So if we have an assumption and the assumption is met, the test will run. If the assumption is not met, the test will be aborted. For assertions if the assertion is met, that test will succeed and if the assertion is false, the test will fail. So just to make sure that you grasp this correctly, an assumption that is met might still lead to a failed test in case the assertion that follows is false. Assumptions doesn't say anything about the outcome of a…

Contents