Testing Spring Boot Application with JUnit and Mockito

Udemy Course: Testing Spring Boot Application with JUnit and Mockito - Course

Learn how to write Unit tests and Integration tests in BDD style for Spring Boot application using JUnit 5, Mockito, AssertJ, Hamcrest & JsonPath.

Learn Unit testing Repository, Service, and Controller Layers

Learn Integration testing Spring Boot Application

Spring Boot Overview

Spring Boot is an opinionated framework that helps developers build Spring-based applications quickly and easily.

The main goal of Spring Boot is to quickly create Spring-based applications without requiring developers to write the same boilerplate configuration again and again.

Spring Boot is a very popular framework to develop REST web services and microservices.

What you'll learn in this course?

  • Learn to write industry-standard Unit and Integration tests in BDD (Behaviour Driven Development) style using Spring Boot Starter Test dependency from scratch
  • Learn how to use BDD (Behaviour Driven Development) format that is given/when/then to write Unit tests.
  • Learn to Unit test the Spring boot application Repository layer
  • Learn to Unit test the Spring boot application Service layer
  • Learn to Unit test the Spring boot application Controller layer
  • Learn how to do Integration testing for the Spring boot application.
  • You will learn to use the most important Unit Testing ANNOTATIONS - @SpringBootTest, @WebMvcTest, @DataJpaTest, and @MockBean
  • Use ALL the FRAMEWORKS in Spring Boot Starter Test - JUnit, Spring Test, Spring Boot Test, AssertJ, Hamcrest, Mockito, JSONassert, and JsonPath.
  • You will learn to write Unit tests using Mocks and Stubs created with Mockito
  • Learn how to use Mockito annotations to create mock objects.
  • Learn to Write Integration Tests using a MySQL database.
  • You will learn to Write INDEPENDENT Integration tests for RESTFUL web services talking with MULTIPLE LAYERS - controller, service, and repository layers.


  • Java basics
  • JUnit basics
  • Mockito basics
  • Basic understanding of using IntelliJ IDEA

Tools and Technologies used in this course

Technologies and Libraries:
  • Java 11+
  • Spring Boot
  • Spring MVC
  • Spring Data JPA ( Hibernate)
  • JUnit 5 Framework
  • Mockito 4 (Latest)
  • Hamcrest framework
  • AssertJ Library
  • JsonPath Library
  • IntelliJ IDEA
  • H2 In-memory database ( for repository layer testing)
  • MySQL database ( for Integration testing)

Course Link

Check out my Testing Spring Boot Application with JUnit and Mockito: https://www.udemy.com/course/testing-spring-boot-application-with-junit-and-mockito/?referralCode=A75C5DD2967469FE7BDF

Course Intro Video