Skip to content
UdemyJava Spring FrameworkPaid courseIntermediate levelCertificate

Spring Boot Unit Testing with JUnit, Mockito and MockMvc (Udemy.com)

Develop Real-Time Spring Boot Unit Tests: JUnit, Mockito, MockMvc, TDD, JsonPath, Hamcrest, H2 Embedded DB, MySQL

Created by: Chad Darby

Last updated January 2026

icon
What you will learn

  • Explore the architecture of the Spring Boot 3 testing framework and write integration tests
  • Develop unit tests with JUnit 5 and supporting JUnit Assertions
  • Mock Spring container dependencies using Mockito
  • Apply Test Driven Development (TDD) using JUnit 5, Mockito and Spring Boot 3
  • Test Spring Boot MVC web applications with MockMvc and ModelView assertions
  • Test Spring Boot REST APIs with MockMvc, JsonPath and Hamcrest
  • Develop integration tests for Spring Data JPA including database init and cleanup
  • We are RESPONSIVE INSTRUCTORS ... post your questions and we will RESPOND in 24 hours.
  • Spring Boot developers with JUnit and Mockito testing are in HIGH-DEMAND. Level up your career!
  • You can DOWNLOAD all source code and PDFs. Perfect for offline LEARNING and REVIEW.

icon
Quality Score

No CourseDuck member has rated this course yet. Taken it? Give each part a thumbs up or down.

Content Quality
/
Video Quality
/
Qualified Instructor
/
Course Pace
/
Course Depth & Coverage
/

Overall Score : 96 / 100

icon
Course Description

Spring Boot is the most popular framework for building enterprise Java applications. Spring Boot includes testing support to develop unit tests and integration tests using JUnit, Mockito and MockMvc. By developing tests, you can create applications with better code design, fewer bugs, and higher reliability. This course shows you how to take full advantage of Spring Boot's testing support.

You will also use modern development tools such as IntelliJ (free version) and Maven. All of the projects are based on Maven, so you are free to use any IDE tool that you want.

---

In this course, you will get:

- All source code is available for download

- Responsive Instructors: All questions answered within 24 hours

- PDFs of all lectures are available for download

- Professional video and audio recordings (check the free previews)

- High quality closed-captions / subtitles available for English and 14 other languages (new!)

---

Over 3,000+ Reviews!

- (the most reviews for any Spring Boot Unit Testing course on Udemy, nearly DOUBLE the nearest competitor)


Students love this course! 5-star reviews

Chad Darby and Eric Roby are great at delivering the materials and giving good real-world examples of concepts. they make the course a very enjoyable class, This course is very thorough and detailed. Thank you - Ninos


Great course, the material is explained in such a clear way. I enjoy it a lot. Highly recommendable. - Ardak Sydyknazar


Chad Darby's courses are the best on Udemy. Thanks him I've got my first work and got promotion on the second one. Good job, my friend! (c) :) - Andrii Hryhoriev


this is my 4th Course with Mr. Darby, and his courses are so special. Organized, clear concepts, amazing material. and the most important his Knowledge of the Topic and he really deliver the information's for us. just amazing. - Ra'ed Abu Sa'da

---

In this course, you will learn how to:

JUnit

  • Develop JUnit Tests

  • Set up projects to use JUnit

  • Apply JUnit assertions: Equals/Not Equals and Null/NotNull

  • Apply JUnit assertions: Same/Not Same and True/False

  • Leverage JUnit lifecycle annotations

  • Define custom display names for JUnit tests

  • Check for exceptions and timeouts

  • Define execution order in JUnit tests

  • Perform code coverage analysis for JUnit tests

  • Apply conditionals with JUnit tests


Test Driven Development (TDD)

  • Apply Test Driven Development for build tests and application code

  • Create a failing test first

  • Update your code to make the tests pass

  • Take your tests from RED to GREEN

  • Apply TDD to a coding project

  • Leverage parameterized tests with TDD


Spring Boot Unit Testing Support

  • Explore annotations for Spring Boot Unit Testing support

  • Apply the @SpringBootTest annotation

  • Read Spring Boot application properties and inject values using the @TestPropertySource annotation

  • Perform assertEquals and assertNotEquals

  • Leverage Spring Boot singleton beans and prototype beans


Mocking with Mockito

  • Identify the need for mocking during test development

  • Leverage Mockito in JUnit tests

  • Applying the @MockitoBean annotation for injection (new in Spring Boot 3.4)

  • Throwing exceptions with Mocks


Spring Reflection Utils

  • Identify use cases for applying reflection in your JUnit tests

  • Apply ReflectionTestUtils to access non-public fields and methods

  • Integrate Spring Reflection Utils in your JUnit tests


Database Integration Testing

  • Identify the need for database integration testing during test development

  • Add database setup and clean code using @BeforeEach and @AfterEach

  • Leverage an embedded database to ease with testing setup and maintenance.

  • External SQL statements using @Sql annotation


Testing Spring Boot MVC Web Apps with MockMvc

  • Apply Spring Boot using testing for a Spring MVC CRUD web app

  • Identify use cases for testing Spring MVC @Controller

  • Configure the JUnit test case using @AutoConfigureMockMvc

  • Inject the MockMvc dependency for testing Spring MVC Controllers

  • Send HTTP Requests to Spring MVC Controllers and assert the results

  • Assert the view name returned by the Spring MVC Controller

  • Assert model attributes for the desired values


Testing Spring Boot REST APIs with MockMvc

  • Apply Spring Boot using testing for a Spring REST CRUD API

  • Inject the MockMvc dependency for testing Spring MVC @RestController

  • Send HTTP Requests to Spring MVC @RestController and assert the results

  • Leverage Jackson Object Mapper to send JSON data to REST API endpoint

  • Expect successful response and desired content type

  • Apply JsonPath to verify contents of JSON response



Compared to other Spring Boot Unit Testing courses

This course is up to date and covers recent versions of Spring Boot 3. We make use of modern development tools such as IntelliJ (free version) and Maven.

We are very responsive instructors and we are available to answer your questions and help you work through any problems.

Finally, all source code is provided with the course along with setup instructions.


Student Reviews Prove This Course's Worth

Those who have reviewed the course have pointed out that the instruction is clear and easy to follow, as well as thorough and highly informative. 

icon
Udemy Discount

The discount is applied through our link. Open the course from here and Udemy's current promotional price is applied at checkout on most courses, no code to type.

Some courses are excluded from Udemy's promotions. If the price does not drop, clear your browser cookies and use the button again.

icon
Instructor Details

Chad Darby

Chád (shod) Darby is an author, instructor and speaker in the Java development world. 

Chád is a contributing author to several Java books, including  Professional Java E-Commerce (Wrox Press), Beginning Java Networking  (Wrox Press), and XML and Web Services Unleashed (Sams Publishing). 

Chád has Java certifications from Oracle and IBM. 

He holds a B.S. in Computer Science from Carnegie Mellon University. 

icon
More courses by Chad Darby

$129.99

Free

$99.99

$139.99

$54.99

$99.99

icon
More Java Spring Framework courses

$84.99

$94.99

$109.99

$79.99

$129.99

$94.99

icon
Reviews

4.8

4,042 ratings on Udemy

Select a bar to show only those reviews.Select the bar again to show every rating.

By Ricardo Mediavilla on 4/5/2026

Excellent quality course on TDD, Java, Spring Boot and unit testing. Highly recommend it for anyone new to the subject or those looking to refresh or stay sharp.

By James Biswell on 4/1/2026

This is an excellent course with comprehensive explanations and learning materials throughout, incrementally increasing its knowledge outcomes and complexity in a carefully thought out and logical way that is very well presented. Thank you!

By Anonymized User on 11/12/2025

Great course for learning JUnit and Mockito. Clear explanations, practical examples, and hands-on exercises make it easy to apply concepts in real projects. Could use a few more advanced scenarios, but overall very helpful and well-structured.

By Juan Felipe Cardona Lora on 11/6/2025

Very good course, I think it covers most of what is used when developing tests in an application. Perhaps one area for improvement would be the number of projects created or divided; it would be ideal to build everything within a single project that grows over time, as this would better illustrate where each library or API is used for certain tests in the context of a real project.

By Daniel Martínez Salvador on 10/5/2025

Very useful and well-explained course. It covers everything you need to write professional tests in Spring Boot 3 with JUnit 5 and Mockito. Ideal for improving your understanding of TDD, MockMvc, and testing with embedded databases. Highly recommended.

By Jose Fidel Diaz on 9/16/2025

Very educational and well-explained course. The examples really help you understand the concepts introduced, and I was able to learn concepts I didn't know before. I love how Chad Darby structures his courses.

By Hardik Gupta on 10/5/2024

This is the nice Course Who Wants to Understand Working Environment of Junit5 and Mockito . Kudos to Instructor Chad Dary for creating such amazing Course.

By Trevor Muhammad on 7/21/2023

A++ level course on unit testing. I am migrating away from using print statements to confirm my program works. Now, I can use unit testing with confidence. I stop after several video sections to build a separate and different program to test my recall of the skills taught.

By Nikhil on 12/11/2022

Chad is a wonderful instructor. He is excellent in explaining everything that is useful in terms of small packages that we need to run the unit tests in this course. I recommend everyone to view and learn the full course.

By Luiz carlos on 11/4/2022

The best course about the subject, the instructor Chad Darby is the best explaining, i already bought the course about springboot and angular and also the courses is really good to understand.

Showing all 10 reviews on CourseDuck

Read all 4,042 reviews on Udemy