unit-test-wiremock-rest-api

Mock external HTTP endpoints with WireMock for REST API unit tests.

Updated Mar 2, 2026
One-click install
npx skills add https://github.com/MassimilianoPili/claude-code-config --skill unit-test-wiremock-rest-api-massimilianopili
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unit-test-wiremock-rest-api
Source: https://github.com/MassimilianoPili/claude-code-config/tree/main/skills/unit-test-wiremock-rest-api
Command: npx skills add https://github.com/MassimilianoPili/claude-code-config --skill unit-test-wiremock-rest-api-massimilianopili

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enables developers to create reliable unit tests for services that interact with external REST APIs by mocking HTTP endpoints, preventing flaky tests and reducing reliance on live services.

Core Features & Use Cases

  • HTTP Stubbing: Define predictable responses for external API calls.
  • Request Verification: Assert that your service makes correct requests to external APIs.
  • Error Scenario Testing: Simulate various error responses (4xx, 5xx) for resilience testing.
  • Use Case: Test a payment processing service's integration with a third-party payment gateway by stubbing successful and failed transaction responses.

Quick Start

Use the unit-test-wiremock-rest-api skill to stub a GET request to '/users/123' with a 200 OK response containing user data.

Frequently Asked Questions about unit-test-wiremock-rest-api

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

FAQPage Schema
How do I mock external REST API calls in JUnit 5 unit tests?

Mock external REST API calls in JUnit 5 unit tests by using WireMock to stub HTTP endpoints. This approach provides predictable responses for external services, preventing flaky tests and eliminating reliance on live APIs.

What is the best way to test error scenarios for third-party API integrations?

Test error scenarios for third-party API integrations by simulating 4xx and 5xx error responses using WireMock. This approach verifies your service's resilience and error handling without modifying the actual external API.

How do I verify HTTP request details sent to an external API during testing?

Verify HTTP request details sent to an external API during testing using WireMock's request verification features. This asserts that your service makes correct requests with expected headers and payloads to the mocked endpoints.

Do I need AssertJ to stub HTTP responses with WireMock?

Yes, you need AssertJ along with JUnit 5 and WireMock to implement tests using this skill. AssertJ is required to perform assertions on stubbed responses and verified request details during unit test execution.

When should I use HTTP stubbing instead of a live service for unit testing?

Use HTTP stubbing instead of a live service for unit testing when you need to ensure test reliability and avoid flaky tests caused by network issues. Mocking external APIs is ideal when testing payment gateways or other third-party integrations.