Spring Boot Testing with JUnit 5, Mockito & Testcontainers (Udemy.com)
Unit tests and Integration tests for Spring Boot App and Spring WebFlux App using JUnit 5, Mockito and Testcontainers
Created by: Ramesh Fadatare
Last updated September 2026
What you will learn
- 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 everything about JUnit Framework 5
- Learn to Unit test Spring boot application Repository layer
- Learn to Unit test Spring boot application Service layer
- Learn to Unit test Spring boot application Controller layer - Unit test REST API's
- 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.
Quality Score
No CourseDuck member has rated this course yet. Taken it? Give each part a thumbs up or down.
Overall Score : 92 / 100
Course Description
In this course, you will learn how to write Unit tests and Integration tests in BDD style for Spring Boot applications as well as Spring WebFlux applications using JUnit 5, Mockito, AssertJ, Hamcrest, JsonPath, and Testcontainers frameworks.
Recent update: I have added lectures on JUnit 5 fundamentals.
Important note: This course is updated to use Spring Boot 3.
Type the code along with me in the videos. If you follow along with me, then this will enhance your learning experience.
The source code and PDF files (class notes) are available for download.
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 repeatedly.
Spring Boot is a popular framework for developing REST web services and microservices.
Spring WebFlux Overview
Spring 5 includes Spring WebFlux, which provides reactive programming support for web applications.
Spring WebFlux internally uses Project Reactor and its publisher implementations, Flux and Mono.
The new framework supports two programming models:
Annotation-based reactive components
Functional routing and handling
This course will focus on building reactive REST APIs using annotation-based reactive components.
What you'll learn?
Learn JUnit 5 framework fundamentals.
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.
Learn how to do Integration testing using Testcontainers // very important
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 by talking with MULTIPLE LAYERS - controller, service, and repository layers.
Learn Building Reactive CRUD REST APIs using Spring WebFlux
Learn Unit Testing Reactive CRUD REST APIs
Learn Integration Testing Reactive CRUD REST APIs
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
Spring WebFlux
MongoDB
IDE:
IntelliJ IDEA
Database:
H2 In-memory database ( for repository layer testing)
MySQL database ( for Integration testing)
MongoDB database (for Integration testing)
Excellent reviews from Students on this course:
"Ramesh is a great teacher; he provides very clear explanations of complex concepts."
"Ramesh explains things very well! His instructions are easy to follow and understand. The course is very beneficial."
- Well structured course covering all layers of testing
- Implement each method with the "right to the point" explanation
- Nice introduction to TestContainers
- Easy to code along
- Fast answers from the instructor
Looking for more deep dives courses such as Maven, Gradle, DevOps tools used in production."
"Awesome course.
All the basics needed to test a spring application are discussed, and more.
Exactly what i needed and coudn't find anywhere.
Ramesh is a great instructor.
Thank you sir !"
"A very good course explained with excellent examples.
Lot to learn from this course, covered every layer of a typical Spring Boot application."
"I really appreciate the trainer Ramesh to providing is this amazing course,
the content of this course and explanation is great."
"Wonderful Sir, Loved the way u explain things. And I am very lucky that I found this course at right time."
"I am personally very impressed with this course, if you dont have any prior experience of unit testing I am pretty sure that after taking this course you will feel more confident and I would be happy if the lecturer could also release some training tutorials about Microservices and TDD approach. thanks and wish you all the successes."
"Even though as a experience guy, this course was very useful.."
"The course is great and covers all I need to create my tests.
I truly recommend it ."
"Great course. This is the second course I am taking from Ramesh. Interesting so far."
"Awesome course and highly recommend it."
"This course is a good match for me. Especially so because it's new and up to date."
"great teacher and great course"
Instructor Details
- 4.6 Rating
1,710 Reviews
Ramesh Fadatare
Hi, I'm Ramesh Fadatare, a Software Engineer, Udemy Instructor Partner, Blogger, and YouTuber teaching Java, Spring Boot, Microservices, REST APIs, Hibernate, Angular, React, Kafka, Docker, and Full-Stack Java Development.
Along with Java, I also teach AI, Generative AI, ChatGPT, Google Gemini, NotebookLM, Claude, AI Tools, LLMs, RAG, AI Agents, and Agentic AI.
I have 15+ years of software engineering experience and I am a VMware Spring Certified Professional.
I am the founder of Java Guides, one of the top Java learning websites with 1 million+ views per month. I also run two YouTube channels: one focused on Java with 187K+ subscribers and another focused on AI with 13K+ subscribers.
My teaching style is simple, practical, and beginner-friendly. I explain concepts step by step with real-world examples.
Note: All my courses are available only on the Udemy platform, so you can join my courses here.
More courses by Ramesh Fadatare
Microservices with Spring Boot, Spring Cloud, Docker & Kafka (2026)
4.7 (3,777 Reviews)
Provider: Udemy
Time: 42.1h
$94.99
Building Real-Time REST APIs with Spring Boot - Blog App (2026)
4.5 (3,341 Reviews)
Provider: Udemy
Time: 37.8h
$94.99
Full-Stack Java Developer Course with Spring Boot 4 & React (2026)
4.4 (1,578 Reviews)
Provider: Udemy
Time: 20.1h
$84.99
Spring Boot + Apache Kafka Course - The Practical Guide (2026)
4.5 (1,540 Reviews)
Provider: Udemy
Time: 5.6h
$59.99
Spring 7 & Spring Boot 4 for Beginners (Includes 8 Projects) (2026)
4.4 (1,401 Reviews)
Provider: Udemy
Time: 53.3h
$79.99
Spring Boot 3 Thymeleaf REAL-TIME Web Application - Blog App (2026)
4.5 (486 Reviews)
Provider: Udemy
Time: 12h
$79.99
More Java Spring Framework courses
Spring Boot Unit Testing with JUnit, Mockito and MockMvc (2026)
4.8 (4,042 Reviews)
Provider: Udemy
Time: 9.9h
$84.99
Spring WebFlux Masterclass: High-Performance Reactive APIs (2026)
4.8 (1,920 Reviews)
Provider: Udemy
Time: 13.3h
$84.99
Microservices with Spring Boot, Spring Cloud, Docker & Kafka (2026)
4.7 (3,777 Reviews)
Provider: Udemy
Time: 42.1h
$94.99
Spring Boot Course: Learn Spring Boot & Build Web APIs (2025)
4.7 (3,377 Reviews)
Provider: Udemy
Time: 11.9h
$109.99
Spring Professional Certification Exam Tutorial - Module 04 (2019)
4.7 (1,018 Reviews)
Provider: Udemy
Time: 4.6h
$79.99
Spring Boot 4, Spring 7 & Hibernate for Beginners (2026)
4.6 (95,333 Reviews)
Provider: Udemy
Time: 35.5h
$129.99
Reviews
By Bhaskararao Chappa on 11/17/2024
I have 3 years of experience working with Spring MVC, and I found your courses to be extremely well-structured and easy to follow. The explanations are clear, and the practical examples make it easier to grasp the new features and concepts.The transition from Spring MVC to Spring Boot feels smooth thanks to the way you’ve covered the topics, and I’m gaining confidence in applying JUnit and exploring the latest features of Spring Framework 6.
By Jeff Aldrich on 2/20/2024
A very good course. Ramesh is extremely qualified and knowledgeable and provided a good overview of testing the Spring Boot framework. My only minor criticism is that the pace of the course is not consistent. It begins somewhat slowly with quite a bit of repetition but by the time one gets to the WebFlux sections the pace is almost too fast. For example, though this is not a Reactive/WebFlux course, it would be helpful to have at least brief explanations for why .block() and .subscribe() are used in WebFlux testing and to have some negative test result scenarios. I was also not clear on why the BDD syntax was abandoned in the WebFlux integration tests. Overall, though, I was very satisfied with the course.
By Héctor Armando Cortez on 12/15/2023
A really great course to understand how unit and integration testing works in a RESTful API or even a reactive RESTful API. The teacher Ramesh is fantastic, any questions about errors that may appear or suggestions you may have will be answered quickly with examples. A course that you should take if you want to advance professionally in your career as a developer.
By Mahmudul Hasan on 5/18/2023
To be honest this course gives all the ideas which you need for writing unit test cases as a beginner. The instructor tries to give proper explanations whatever he teaches in this course. However, if you are an advanced spring boot developer this course might not help you that much. I would like to expect more advanced contents from him in future. I liked the way he teaches though. Last but not the least the instructor avoided to answer my question when I asked him some advanced question in the Q&A section. As an instructor he should have advanced knowledge as well.
By Andres Diaz on 4/3/2023
I recommend to buy this course. One can follow along and learn concepts, despite the instructor's thick indian accent which should not be a problem unless your english is not so good (Ramesh has poor diction and transcription is not accurate either). Ramesh has reply my answers promptly every time, which is always a good thing, and the course is far from being left out. Why four stars only? Well, it lacks something fundamental when it comes to testing: coverage review. Besides in the last project no negative scenarios were covered. He replied these topics are being considered for future updates...I give him the benefit of the doubt, since new videos pop up frequently.
By Romulo Gomes on 2/8/2023
O curso foi muito bom! Competente em apresentar o conteúdo e cumpre com a grade curricular que ele propõe. O professor pode ser repetitivo eventualmente, e nas aulas de Integration Testing, ele cometeu um pequeno erro ao achar que @Testecontainer já era o suficiente para rodar no banco de dados do docker, mas na verdade ele não percebeu que estava rodando no banco local, antes de add a @DynamicPropertySource . Apenas por esses 2 pontos, não ganhou 5 estrelas. Hi, Artem, I bought the notebook last Friday and it is estimated to be delivered on February 15th. As soon as Dell makes the receipt available, I'll send it here
By Rubens Souza on 6/22/2022
The course is great. It really teached me how to start building my own unit tests. Since I followed the classes doing unit tests for an API I had build previously, using some dtos, I had some troubles while testing, specially the service layer and the post method in controller layer, because the conversion from dtos to entity and vice versa. It would be interesting to address the problems while testing APIs that uses dtos. It would make the course more complete. Thank you for all the information and knowledge that you shared with me!
By Anonymized User on 5/26/2022
Overall course is good the only problem was in Test Container testing.. see before you added that @DynamicPropertySource annotation the testing was happening with the local mysql database not with the Docker database . Otherwise Excellent course. ( same mistake in last video ) Thank you.
By Alex Golub on 5/6/2022
✔ Well structured course covering all layers of testing ✔ Implement each method with the "right to the point" explanation ✔ Nice introduction to TestContainers ✔ Easy to code along ✔ Fast answers from the instructor To be even more engaged adding assignments after each subject learned can be a great addition to future courses. Looking for more deep dives courses such as Maven, Gradle, DevOps tools used in production
By Mohammad Haroon Torab on 1/17/2022
I am personally very impressed with this course, if you dont have any prior experience of unit testing I am pretty sure that after taking this course you will feel more confident and I would be happy if the lecturer could also release some training tutorials about Microservices and TDD approach. thanks and wish you all the successes.











