132-java-testing-integration-testing

Generate WireMock-based BaseIntegrationTest scaffolds for Maven Java projects.

423|90|Updated Feb 8, 2025
One-click install
npx skills add https://github.com/jabrena/cursor-rules-java --skill 132-java-testing-integration-testing
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: 132-java-testing-integration-testing
Source: https://github.com/jabrena/cursor-rules-java/tree/main/skills/132-java-testing-integration-testing
Command: npx skills add https://github.com/jabrena/cursor-rules-java --skill 132-java-testing-integration-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Java services often struggle to reliably test integration points with external HTTP systems. This skill provides a guided approach to set up, review, or improve Java integration tests using WireMock stubs, and generates a reusable BaseIntegrationTest scaffold.

Core Features & Use Cases

  • Detects outbound HTTP dependencies in code (HttpClient, RestTemplate, Feign, Retrofit, OkHttp) and proposes a REST-testing topology based on WireMock.
  • Generates a tailored BaseIntegrationTest.java with WireMockExtension, @RegisterExtension, and a @BeforeAll block that propagates coordinates via System.setProperty().
  • Creates starter WireMock mappings under src/test/resources/wiremock/mappings per identified service.
  • Encourages per-test stub registration and verification of HTTP interactions to keep tests isolated and deterministic.
  • Documents anti-patterns to avoid (e.g., global stubs, mocked HTTP clients) to preserve real HTTP-pipeline testing.

Quick Start

Use a clean Maven build to validate compilation and trigger the scaffolding workflow.

Frequently Asked Questions about 132-java-testing-integration-testing

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

FAQPage Schema
How do I set up Java integration tests with WireMock stubs for HTTP calls?▼

To set up Java integration tests with WireMock, you need a Maven project with WireMock dependencies and a resources layout. The skill analyzes your codebase, detects HTTP client usage, and generates a BaseIntegrationTest scaffold with dynamic coordinates.

What is the best way to test outbound HTTP dependencies in a Java service?▼

Testing outbound HTTP dependencies in a Java service is best achieved by using WireMock to stub HTTP calls. This approach creates a REST-testing topology that verifies HTTP interactions while keeping tests isolated and deterministic.

Does this approach support detecting multiple HTTP clients like RestTemplate and OkHttp?▼

Yes, this approach supports detecting multiple HTTP clients including HttpClient, RestTemplate, Feign, Retrofit, and OkHttp. It analyzes your codebase to identify these outbound HTTP dependencies and proposes a tailored REST-testing topology based on WireMock.

Why should I avoid global stubs and mocked HTTP clients when using WireMock?▼

You should avoid global stubs and mocked HTTP clients because they are anti-patterns that compromise test isolation. Using WireMock as an HTTP stub preserves real HTTP-pipeline testing, ensuring your tests remain deterministic and accurately reflect integration points.

How do I propagate dynamic coordinates to my Java integration tests?▼

To propagate dynamic coordinates to your Java integration tests, the generated BaseIntegrationTest includes a @BeforeAll block that sets these coordinates via System.setProperty(). This ensures the WireMockExtension and @RegisterExtension have the necessary configuration.