
Unit Test Wiremock Rest Api
Java unit-test patterns for stubbing external REST APIs with WireMock, including error and timeout simulation.
- CCM score
- 59 of 100
- skills.sh installs
- 4K
- GitHub stars
- 372
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers stubbing API responses, verifying request details, and simulating timeouts and 4xx/5xx failures
- Includes Maven test-scope dependencies, a JUnit 5
WireMockExtensionsetup withdynamicPort(), and AssertJ assertions - Enforces dynamic ports and extension-based resets so parallel tests stay isolated and avoid real network calls
- Designed for Java services that call external REST APIs and need fast, deterministic integration-level unit tests
Install
$ npx -y skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-wiremock-rest-api -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Unit Testing REST APIs with WireMock
Overview
Patterns for testing external REST API integrations with WireMock: stubbing responses, verifying requests, error scenarios, and fast tests without network dependencies.
When to Use
- Testing services calling external REST APIs
- Stubbing HTTP responses for predictable test behavior
- Testing error scenarios (timeouts, 5xx errors, malformed responses)
- Verifying request details (headers, query params, request body)
Instructions
- Add dependency: WireMock in test scope (Maven/Gradle)
- Register extension:
@RegisterExtension WireMockExtensionwithdynamicPort() - Configure client: Use
wireMock.getRuntimeInfo().getHttpBaseUrl()as base URL - Stub responses:
stubFor()with request matching (URL, headers, body) - Execute and assert: Call service methods, validate results with AssertJ
- Verify requests:
verify()to ensure correct API usage
If stub not matching: Check URL encoding, header names, use urlEqualTo for query params.
If tests hanging: Configure connection timeouts in HTTP client; use withFixedDelay() for timeout simulation.
Details
- Repository
- github.com/giuseppe-trisciuoglio/developer-kit
- Categories
- Testing & QA, Java & JVM
- First seen
- May 16, 2026
More from giuseppe-trisciuoglio/developer-kit
All 95- Nextjs Authentication4K
- Spring Boot Actuator4K
- Spring Boot Dependency Injection4K
- Unit Test Parameterized4K
- Unit Test Controller Layer4K
- Unit Test Json Serialization4K
- Spring Boot Saga Pattern3.9K
- Nextjs Data Fetching3.9K
- Spring Data Neo4j3.9K
- Unit Test Security Authorization3.9K
- Nx Monorepo3.9K
- Langchain4j Spring Boot Integration3.9K
- Langchain4j Tool Function Calling Patterns3.9K
- Langchain4j Rag Implementation Patterns3.9K
- Unit Test Scheduled Async3.9K
- Rag3.9K
- Unit Test Utility Methods3.9K
- Qdrant3.9K
- Unit Test Exception Handler3.9K
- Unit Test Mapper Converter3.9K
- Langchain4j Ai Services Patterns3.9K
- Unit Test Caching3.9K
- Unit Test Config Properties3.9K
- Unit Test Application Events3.9K
Similar to Unit Test Wiremock Rest Api
More Testing & QA
wiremock-standalone-dockergiuseppe-trisciuoglio/developer-kit3.6K installsStandalone WireMock Docker setup that stubs external APIs for integration tests, including error and timeout simulation.
132-java-testing-integration-testingjabrena/plinth128 installsJava integration test setup with WireMock stubs, dynamic service coordinates, and per-test isolation guidance.
unit-test-service-layergiuseppe-trisciuoglio/developer-kit4K installsMockito-based unit test patterns for @Service classes that isolate business logic from databases and external APIs.
mocking-stubbingaj-geddes/useful-ai-prompts434 installsStructured guide for isolating unit tests with mocks, stubs, spies, and test doubles across Jest, unittest.mock, and Mockito.
api-testing-observability-api-mocksickn33/agentic-awesome-skills451 installsAPI mocking framework that simulates real API behavior, error shapes, and latency for parallel development and testing.
java-testingpluginagentmarketplace/custom-plugin-java917 installsJava testing guide covering JUnit 5, Mockito, AssertJ, and Spring Boot integration tests with Testcontainers.