JUnit

In this post, we described how to use JUnit 5 to test your Spring MVC application with Maven. Setup Maven Dependencies We can get the required dependencies by declaring the junit-jupiter-api (version 5.x) dependency in our pom.xml file. This dependency provides the public API for writing tests and extensions. <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.1.0</version> <scope>test</scope> </dependency> If we are using an IDE that is bundled with an older JUnit 5 version, it throws an exception when we try to run our unit tests by using our IDE. We can fix this problem by adding the following dependency to our POM file: