testing

Test Spring Boot applications with Mockito, WireMock, and jOOQ.

Updated Jun 23, 2024
One-click install
npx skills add https://github.com/jo-pouradier/dotfiles --skill testing-jo-pouradier
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/jo-pouradier/dotfiles/tree/main/coding-agent/.claude/skills/testing
Command: npx skills add https://github.com/jo-pouradier/dotfiles --skill testing-jo-pouradier

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill consolidates best practices and patterns for testing Spring Boot applications using Mockito for unit tests, WireMock for API mocking, and jOOQ for data access layers, enabling faster, safer code changes.

Core Features & Use Cases

  • Unit testing services and repositories with Mockito
  • Integration testing controllers with MockMvc and WireMock for external API mocks
  • End-to-end testing patterns leveraging jOOQ and testcontainers where applicable
  • Use Case: validate a service that fetches data from an external API and persists via jOOQ, ensuring mocks reproduce deterministic behavior

Quick Start

Set up a Spring Boot project with Mockito, WireMock, and jOOQ on the classpath, then write a simple test using @SpringBootTest or @WebMvcTest to illustrate the workflow.

Frequently Asked Questions about testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Spring Boot services that fetch data from external APIs and persist it with jOOQ?

Testing Spring Boot services with jOOQ involves mocking external APIs using WireMock and verifying data persistence layers. This skill provides patterns for unit testing services with Mockito and integration testing controllers to ensure deterministic, reproducible behavior across data fetching and persistence workflows.

Can I use WireMock with MockMvc for Spring Boot integration testing?

Yes, WireMock integrates with MockMvc for Spring Boot integration testing. This skill demonstrates how to mock external API calls with WireMock while using MockMvc to validate controller endpoints, ensuring isolated and deterministic integration tests without real external dependencies.

What's the best way to unit test Spring Boot repositories using Mockito?

Unit testing Spring Boot repositories with Mockito requires mocking data access dependencies to isolate business logic. This skill consolidates best practices for configuring Mockito mocks to verify repository interactions and service layer behaviors, producing fast and reproducible unit test results.

Does Spring Boot testing with jOOQ support end-to-end scenarios with testcontainers?

Spring Boot testing with jOOQ supports end-to-end scenarios leveraging testcontainers where applicable. This skill provides patterns for setting up comprehensive end-to-end tests that validate the full data access flow using jOOQ alongside containerized database environments for realistic testing.

Why are my Spring Boot integration tests failing with non-deterministic external API behavior?

Spring Boot integration tests fail with non-deterministic behavior when external APIs are not properly mocked. This skill addresses this by standardizing WireMock usage to stub external API responses, ensuring mocks reproduce deterministic behavior for consistent and reproducible test execution.