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

Summary

This section provides a detailed insight of how JUnit 5 can be used in conjunction with third-party frameworks, libraries, and platforms. Thanks to the Jupiter extension model, developers can create extensions which allows seamless integration with external frameworks to JUnit 5. First, we have seen the MockitoExtension, an extension provided by the JUnit 5 team to use Mockito (a notorious mock framework for Java) in Jupiter tests. Then, we have used the SpringExtension, which is the official extension provided in the version 5 of the Spring Framework. This extension integrates Spring into the JUnit 5 programming model. This way, we are able to use Spring’s application contexts (that is, the Spring’s DI container) in our tests.

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