Unit Testing for Java Context

Learn how to write a unit test using the Spring test features.

This lesson shows how to write a unit test using the Spring test features. We will remove the springboot-starter-test dependency from the pom.xml file, write our own dependencies and then use them to test the RecommenderImplementation class.

spring-test and junit dependency

We will start by replacing the springboot-starter-test dependency — which is automatically included in a Spring Boot project — with the spring-test dependency along with the junit-jupiter-engine dependency.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.