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.

Get hands-on with 1400+ tech skills courses.