Course Overview

In this course we are going to have a detailed look at how to write unit and integration tests for a Java and Spring application, starting from the most basic examples and reaching the most complex integration test cases possible within a Spring application. In order to better understand the practical value of unit and integration tests we will use a fully functional Spring project, for which we will take each comprising part and do full unit test coverage making sure we cover all relevant test cases. While writing our unit tests we will also get into specific details on how to establish, create and manage our tests data in order to adhere to Java development principles and practices, which ensure highest level of re-usability and flexibility for our tests.

  • Understand how to design and implement unit tests.

  • Correctly design, implement and manage test cases.

  • Correctly design, create and manage test data.

  • Design and implement integration tests in order to safeguard MVC and REST endpoints.

  • Design and implement integration tests in order to safeguard JPA repositories.

Course curriculum

  • 1

    Introduction

    • Intro

    • What are Unit Tests?

    • Levels of Testing

    • Testing Practices

    • Anatomy of a Unit Test

    • Unit Testing Quiz

    • Unit Testing Key Takeaways

  • 2

    Sample Project Setup

    • Sample Project

    • Project Setup

  • 3

    JUnit 5

    • JUnit 5 Overview

    • Only-once Setup and Tear-Down

    • Assertions and Assumptions

    • Testing Behavior, not Correctness

    • JUnit Quiz

    • JUnit Key Takeaways

  • 4

    Test Data Management

    • Execution Branching

    • Boundary Value Analysis

    • Test Data Management

    • Test Data Management Quiz

    • Test Data Management Key Takeaways

  • 5

    Mockito and Testing in Isolation

    • Unit Isolation

    • Mockito

    • Matchers

    • BDD with AspectJ

    • Mockito Quiz

    • Mockito Key Takeaways

  • 6

    Integration Testing

    • Integration Testing

    • Database Integration Testing

    • Database Constraints

    • MVC/REST API Integration Testing

    • Integration Testing Quiz

    • Integration Testing Key Takeaways

Course Features

  • Quizzes

    Test your knowledge with carefully crafted quizzes that cover all major aspects of the course.

  • Takeaways

    Each course section, provides a downloadable PDF containing the key takeaways of the presented material.

  • Code Samples

    Spring Boot Sample project containing comprehensive examples for all topics covered in this course.

Unit Testing in Java and Spring

Learn how to correctly and efficiently design, create and manage your unit and integration tests for Java and Spring applications.