Let us perform Spring core testing with JUnit 4, Mockito 2.x, and Spring TestContext framework:
- Before we start the configuration, ensure that you have the spring-context module in pom.xml. Then, add the following Spring Test, and now the JUnit 4.x and Mockito 2.x Maven dependencies to your pom.xml:
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> <exclusions> <exclusion> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-core</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.hamcrest</groupId> ...