Advanced JUnit Training

Level

Advanced

Duration

24h / 3 days

Date

Individually arranged

Price

Individually arranged

Advanced JUnit Training

Advanced JUnit 5 is a next-generation framework for creating automated unit tests in Java, offering features such as parameterized tests, dependency injection, full Java 8 support, and a modern API that makes it easier than ever to extend the framework and adapt it to project needs. Frameworks like JUnit 5 are now widely used not only for unit testing but also for higher-level functional tests.

Who is this training for?
  • logo infoshare Anyone who wants to gain or deepen their knowledge of unit testing, JUnit 5, Mockito 2, and best practices in writing unit tests.

What You Will Learn

  • How to perform a complete process from reading data, through transformations, to delivering results
  • Deep understanding of JUnit 5 and its features
  • How to use Mockito for mocking dependencies
  • How to write clean and readable assertions using AssertJ
  • Advanced JUnit 5 features: parameterized tests, nested and repeated tests, extension model
  • Integration with Spring Boot, CI/CD pipelines, and test reporting
  • Best practices for testing databases, APIs, and services using tools like WireMock and TestContainers
  • Migration from JUnit 4 to JUnit 5

Training Program

  • Unit Testing Theory

    • Motivation for writing unit tests
    • Principles of writing good tests
    • Best practices and common mistakes (recurring throughout the training)
    • Three main tools: JUnit 5, Mockito, AssertJ
    • Recap and deep dive into popular tool combinations for unit testing in Java
  • JUnit Architecture Introduction

    • Connecting JUnit to the project
    • Mockito: proper usage, less common features useful in daily work
    • AssertJ: the most readable assertion library in Java
  • JUnit 5 – Advanced Topics

    • Assumptions
    • Test lifecycle overview
    • Repeated and nested tests – use cases
    • Parameterized tests – different types
    • Working with files
    • Method injection – introduction to Extension Model
    • Extension Model deep dive

      • Built-in extensions
      • Writing custom extensions
      • Sharing reusable code between tests via extensions
  • JUnit in Real Life

    • Configuring JUnit 5 with Maven/Gradle
    • Test execution optimization
    • Report generation and CI/CD integration
    • Migrating from JUnit 4 to JUnit 5
  • Spring Boot Testing Support

    • Differences between Spring Boot context tests and typical unit tests
    • When to use a simple test vs full Spring Boot context
    • @SpringBootTest annotation
    • Test configuration and test properties
    • Bean mocks
    • Tests with running server
    • MockMvc
    • Slice tests
  • Database Integration Testing

    • Providing a database for tests
    • Unit testing database interactions
    • When to use unit vs integration tests
    • Testing transactional code
    • Spring Security integration
  • Service Integration Testing

    • WireMock
    • TestWebClient vs TestRestTemplate
    • WireMock integration tests
    • TestContainers – use cases and advantages
    • Contract testing – demo
  • Recap and Final Project

Contact us

we will organize training for you tailored to your needs

Przemysław Wołosz

Key Account Manager

przemyslaw.wolosz@infoShareAcademy.com

    The controller of your personal data is InfoShare Academy Sp. z o.o. with its registered office in Gdańsk, al. Grunwaldzka 427B, 80-309 Gdańsk, KRS: 0000531749, NIP: 5842742121. Personal data are processed in accordance with information clause.