O'Reilly logo

Mastering Software Testing with JUnit 5 by Boni García

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Assumptions

In this part of this section is about the so-called assumptions. Assumptions allow us to only run tests if certain conditions are as expected. All JUnit Jupiter assumptions are static methods in the class Assumptions, located inside the org.junit.jupiter package. The following screenshot shows all the methods of this class:

Methods of the class org.junit.jupiter.Assumptions

On the one hand, the methods assumeTrue and assumeFalse can be used to skip tests whose preconditions are not met. On the other hand, the method assumingThat is used to condition the execution of a part in a test:

package io.github.bonigarcia;import static ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required