Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Testing Java: JUnit 5, Mockito, Testcontainers, REST Assured
Bestseller
Rating: 4.8 out of 5(2,482 ratings)
15,370 students

Testing Java: JUnit 5, Mockito, Testcontainers, REST Assured

Unit Testing & Integration Testing of Java and Spring Boot applications. Test Driven Development(TDD) Explained.
Last updated 12/2025
English

What you'll learn

  • JUnit 5 - basic & advanced topics
  • Test Web Layer and Controllers
  • Test Java code with Mockito - the most popular Mocking Framework.
  • Test Data layer and JPA Repositories
  • Write Spring Boot Integration Tests
  • Test Business and Service layer classes
  • Master Test Driven Development (TDD)
  • Perform Integration testing with Testcontainers
  • Test RESTful Web Services with REST Assured
  • And more...

Course content

16 sections156 lectures10h 40m total length
  • Introduction3:24

    Learn to test Java code with JUnit 5 and Mockito, practice test driven development, and configure Maven and Gradle projects using Intelligent Development Environment Community Edition or Eclipse.

  • Welcome from the instructor1:16
  • What is a Unit Test?8:19

    Write small, self-contained unit tests that invoke a method and verify the expected result using arrange, act, and assert. Use JUnit to test valid and invalid inputs with mock dependencies.

  • Why write Unit Test?2:28

    Unit tests validate code with diverse inputs, prevent missed tests in large teams, and enable regression testing to keep features working after changes.

  • The F.I.R.S.T Principle3:53

    Explains the F.I.R.S.T principle for unit testing: fast, independent, repeatable, self validating, and timely, with practice on writing small, isolated tests that cover happy and negative paths.

  • Testing Code in Isolation4:32

    Learn to test a method in isolation by using dependency injection to supply mocks or stubs and keep tests focused on the method under test.

  • Testing Pyramid2:19

    Follow the testing pyramid: unit tests run fastest with no mocks, integration tests use real objects, and end-to-end UI tests validate the full flow.

  • Quiz. Basics of Unit Testing
  • What is JUnit 5?2:09
  • JUnit and Build Tools1:02

    Explore setting up JUnit across various project types using Maven and Gradle, with IDE support from Eclipse, NetBeans, Anthology, and VS Code, and create projects with or without build tools.

Requirements

  • Basic knowledge of Java

Description

Unit Testing is a must-have skill and this video course is about unit testing.

If you take this video course, you will learn how to test your Java code using JUnit 5 and Mockito framework.

This video course is for beginners and you do not need to have any prior Unit testing knowledge to enrol in this course.


JUnit 5 in Different Java projects

There are different Java projects, build tools and development environments. In this course, you will learn how to create a new project and configure JUnit 5 support for different types of projects, using different development environments and build tools.

You will learn how to create a Unit test in: 

  • IntelliJ IDEA and

  • Eclipse Development environments.

You will learn how to create a Unit test in: 

  • Regular Java project,

  • Maven-based Java project,

  • Cradle-based Java project.


Course Overview

This video course teaches Unit and Integration testing with Java from the very beginning and covers many advanced topics as well. By the end of this course, you will learn:

  • JUnit 5 basics, and

  • JUnit 5 advanced topics.

Once you become familiar with JUnit 5, you will learn to use:

  • Test-Driven Development(TDD)

You will then learn to use another very popular Test framework for Java called: 

  • Mockito

You will also learn how to write:

  • Spring Boot integration tests, and

  • Use Testcontainers to integrate real, containerized services(like databases) into your Java application tests, making sure your test scenarios are realistic without complex setup.

and how to test API endpoints using REST Assured.

By the end of this course you will learn and be able to use all of the following: 


  • Create Unit Tests in IntelliJ,

  • Create Unit Tests in Eclipse,

  • Run unit tests using Gradle,

  • Run Unit Tests using Maven,

  • Use @DisplayName annotation,

  • Use JUnit assertions,

  • Test for Exceptions,

  • Use Lifecycle methods (@BeforeAll, @BeforeEach, @AfterEach, @AfterAll),

  • Run unit tests in any order you need: (Random, Order by Name, Order by Index),

  • Disable Unit test,

  • Repeated Tests with @RepeatedTest annotation,

  • Parameterized tests with @Parameterized annotation

    • @ValueSource,

    • @MethodSource,

    • @CsvSource,

    • @CsvFileSource

  • Change Test Instance lifecycle with @TestInstance (PER_CLASS, PER_METHOD)

  • Learn to Mock objects with Mockito's @Mock annotation,

  • Learn to user Mockito's argument matches,

  • Mockito method stubbing,

  • Mockito Exception stubbing,

  • Verify method call,

  • Call Real Method,

  • Do nothing when a method is called,

  • Write integration tests for Spring Boot applications,

  • and more...


Who this course is for:

  • Java developers interested in learning how to test Java applications with JUnit 5, Mockito and Test Containers
  • Java developers interested in learning how to test RESTful Web Services with REST Assured