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

Rule support in Jupiter

As described before, Jupiter does not support JUnit 4 rules natively. Nevertheless, the JUnit 5 team realized that JUnit 4 rules are widely adopted in many test codebases nowadays. In order to provide a seamless migration from JUnit 4 to JUnit 5, the JUnit 5 team implemented the junit-jupiter-migrationsupport module. If this module is going to be used in a project, the module dependency should be imported. Examples for Maven are shown here:

<dependency>   <groupId>org.junit.jupiter</groupId>   <artifactId>junit-jupiter-migrationsupport</artifactId>   <version>${junit.jupiter.version}</version>   <scope>test</scope></dependency>

The Gradle declaration for this dependency is like this:

dependencies { testCompile("org.junit.jupiter:junit-jupiter- ...

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