GitHunt

Testing Cookbook

CI
Java 25
Maven 4

A collection of small, focused examples for common testing scenarios in Java and Spring Boot.

The goal: show a minimal implementation for each testing approach, including the trade-offs, and provide copy/paste-friendly starting points.

Prerequisites

Suggestion: Use sdkman to configure java and maven versions.

Quickstart

#!/usr/bin/env bash

./mvnw clean install

What’s inside

This repo is organized as a multi-project Maven project:

  • modules/auto-configuration — Testing custom auto-configuration classes / custom spring starters using ApplicationContextRunner
  • modules/bdd — Behavior Driven Development (BDD) tests with Spring, Cucumber, Jupiter, and multiple @CucumberContextConfiguration
  • modules/containers — Integration tests with real services via Testcontainers
  • modules/embedded-db — In-memory DB testing patterns (e.g., H2, Derby, HSQLDB)
  • modules/embedded-kafka — Messaging tests with embedded Kafka
  • modules/localstack — AWS integration-style tests locally with LocalStack and Test Containers
  • modules/web — HTTP Layer tests via: Mockito, @WebMvcTest, RestTestClient, and TestRestTemplate.

References

Languages

Java99.4%Gherkin0.6%

Contributors

MIT License
Created September 25, 2025
Updated January 18, 2026
mtkhawaja/testing-cookbook | GitHunt