Skip to main content
skill CX Codex

132-java-testing-integration-testing — Claude Code skill for Java

A skill that gets an AI agent to set up and clean up Java integration tests: WireMock stubs, per-test isolation, no mocked HTTP clients.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add jabrena/plinth --skill 132-java-testing-integration-testing -a claude-code
Open on GitHub

What 132-java-testing-integration-testing does

The skill covers integration tests for Java services that call outbound HTTP dependencies. The agent scans imports and detects the client stack: HttpClient, feign.*, retrofit2.*, RestTemplate. From there it builds an abstract BaseIntegrationTest, wires in WireMockExtension with @RegisterExtension and allocates a dynamic port via dynamicPort().

Service coordinates reach the tests through System.setProperty() inside @BeforeAll. Stub bodies live under wiremock/files/ and are referenced by bodyFileName. Stubs are registered inside each test method, so one test does not leak into the next. Call checks go through WIREMOCK.verify, and fault injection covers 503 responses plus latency with withFixedDelay. The wiremock-standalone dependency goes in test scope.

Before touching anything, the skill runs ./mvnw compile or mvn compile and stops dead if the build fails. That is a blocking condition, not a suggestion. After the changes it expects ./mvnw clean verify. It also hunts anti-patterns: global stubs in @BeforeAll, Mockito-mocked HTTP clients, hardcoded ports and URLs. If your project already does it that way, expect friction with the existing code. Worth a look at which side is right.

What it helps with

  • build a base integration test class with WireMock
  • detect the HTTP client from imports and stub it
  • pass service coordinates into tests via system properties
  • move response bodies into JSON mappings with bodyFileName
  • drop mocked HTTP clients and global stubs from the suite

Example prompts for the agent

  • Set up integration tests for this Java service with WireMock
  • Review the integration tests and remove the mocked HTTP client
  • Add per-test stub isolation and verify the HTTP interactions

How to install 132-java-testing-integration-testing

1Skills CLI (Vercel)

npx skills add jabrena/plinth --skill 132-java-testing-integration-testing -a claude-code

2Manually: put the files in place

~/.claude/skills/132-java-testing-integration-testing/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/132-java-testing-integration-testing/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about 132-java-testing-integration-testing

How do I install 132-java-testing-integration-testing in Claude?

Run npx skills add jabrena/plinth --skill 132-java-testing-integration-testing -a claude-code. The skill lands in ~/.claude/skills/132-java-testing-integration-testing/SKILL.md.

What does 132-java-testing-integration-testing do?

It helps the agent set up, review or rewrite Java integration tests: a BaseIntegrationTest class, WireMock stubs, per-method isolation and HTTP call verification.

What has to happen before the tests are changed?

The project must compile first: ./mvnw compile or mvn compile. If that fails, the skill stops and applies nothing until the error is fixed.

Source text

SKILL.md · Apache-2.0
---
name: 132-java-testing-integration-testing
description: Use when you need to set up, review, or improve Java integration tests — including generating a BaseIntegrationTest.java with WireMock for HTTP stubs, detecting HTTP client infrastructure from import signals, injecting service coordinates dynamically via System.setProperty(), creating WireMock JSON mapping files with bodyFileName, isolating stubs per test method, verifying HTTP interactions, or eliminating anti-patterns such as Mockito-mocked HTTP clients or globally registered WireMock stubs. This should trigger for requests such as Review Java code for integration tests; Apply best practices for integration tests in Java code; Write Java integration tests with real infrastructure boundaries; Improve Testcontainers integration tests for Java code; Review integration test setup and teardown in Java projects. Part of Plinth Toolkit
license: Apache-2.0
metadata:
  author: Juan Antonio Breña Moral
  version: 0.19.0
---
# Java Integration testing guidelines

Set up robust integration-test infrastructure for Java services using WireMock to stub outbound HTTP dependencies.

**What is covered in this Skill?**

- Infrastructure topology detection: scanning imports for `HttpClient`, `feign.*`, `retrofit2.*`, `RestTemplate`
- Abstract `BaseIntegrationTest` base class
- `WireMockExtension` with `@RegisterExtension`, dynamic port allocation (`dynamicPort()`)
- `usingFilesUnderClasspath(wiremock)`, `@BeforeAll` + `System.setProperty()` for coordinate propagation
- WireMock JSON mapping files (`bodyFileName` referencing `wiremock/files/`)
- Programmatic stub registration via WireMock DSL
- Per-test stub isolation: register stubs inside each test method
- Fault injection: 503 service unavailable, network latency with `withFixedDelay`
- Request verification via `WIREMOCK.verify`
- `wiremock-standalone` Maven dependency (test scope)
- Anti-patterns: global `@BeforeAll` stubs, Mockito-mocked HTTP clients, hardcoded ports or URLs

**Scope:** The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.

## Constraints

Before applying any integration test changes, ensure the project compiles. If compilation fails, stop immediately — do not proceed until resolved. After applying improvements, run full verification.

- **MANDATORY**: Run `./mvnw compile` or `mvn compile` before applying any change
- **SAFETY**: If compilation fails, stop immediately and do not proceed — compilation failure is a blocking condition
- **VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after applying improvements
- **BEFORE APPLYING**: Read the reference for detailed examples, good/bad patterns, and constraints

## When to use this skill

- Review Java code for integration tests
- Apply best practices for integration tests in Java code
- Write Java integration tests with real infrastructure boundaries
- Improve Testcontainers integration tests for Java code
- Review integration test setup and teardown in Java projects

## Workflow

1. **Compile project before integration-test changes**

Run `./mvnw compile` or `mvn compile` and stop immediately if compilation fails.

2. **Read integration-testing reference and detect topology**

Read `references/132-java-testing-integration-testing.md` and detect HTTP client and external dependency integration points.

3. **Set up resilient integration-test infrastructure**

Implement BaseIntegrationTest, WireMock mappings/stubs, per-test isolation, and verification patterns.

4. **Verify with full build**

Run `./mvnw clean verify` or `mvn clean verify` after applying improvements.

## Reference

For detailed guidance, examples, and constraints, see [references/132-java-testing-integration-testing.md](references/132-java-testing-integration-testing.md).

© Juan Antonio Breña Moral · Apache-2.0 · jabrena/plinth

Similar skills

Everything for Testing and QA →

From the same set40

111-java-maven-dependencies Adds code-quality Maven dependencies to your pom.xml: JSpecify, Error Prone with NullAway, VAVR, ArchUnit, JavaMoney. Asks what you need and installs only that. CX Codex +1 388installs 321-frameworks-spring-boot-testing-unit-tests A skill that steers your agent through Spring Boot unit testing: Mockito without a Spring context, slice tests for controllers, parameterized tests. Useful when @SpringBootTest has spread everywhere. CX Codex +1 387installs 112-java-maven-plugins A skill that adds and configures Maven plugins in pom.xml by asking one question at a time. Useful when you need quality checks, coverage or an image build. CX Codex +1 381installs 130-java-testing-strategies A skill that reviews Java tests through RIGHT-BICEP, A-TRIP and CORRECT: missing cases, flaky tests, boundary conditions. CX Codex +1 377installs 142-java-functional-programming A skill that pushes your AI agent to rewrite Java in a functional style: Records, pure functions, Stream API pipelines and Optional. CX Codex +1 376installs 128-java-generics A skill that reviews and refactors Java generics: raw types, unchecked casts, PECS wildcards. Handy when a generic API starts leaking type safety. CX Codex +1 370installs 170-java-documentation A step-based skill that walks an agent through writing README.md, package-info.java and Javadoc for a Maven Java project. Useful when the code exists but the docs don't. CX Codex +1 359installs 322-frameworks-spring-boot-testing-integration-tests A skill for writing and reviewing Spring Boot 4.0.x integration tests: Testcontainers, persistence slices, HTTP assertions. CX Codex +1 357installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor