Generate WireMock stub configurations and response files by analyzing external HTTP service calls in the codebase. Learns existing WireMock patterns and conventions, creates mappings for success, error, and timeout scenarios with response templating. Supports stateful scenarios for multi-step workflows and devcontainer integration. Use when asked to create mock data, add WireMock stubs, or set up local service mocking.
Create WireMock mappings and response files by learning from codebase patterns.
Search the codebase for HTTP client usage:
HttpClient, WebClient, RestTemplateClientBuilder.newClient(), @RegisterRestClient@FeignClientFor each call, identify:
If the project already has WireMock stubs:
src/test/resources/wiremock/mappings/ for mapping formatsrc/test/resources/__files/ for response body formatFor each external service call, create:
Mapping file (mappings/[service]/[scenario].json):
{
"request": {
"method": "GET",
"urlPathPattern": "/api/v1/resource/[0-9]+",
"headers": { "Accept": { "contains": "application/json" } }
},
"response": {
"status": 200,
"headers": { "Content-Type": "application/json" },
"bodyFileName": "[service]/[response-file].json"
},
"metadata": { "description": "[Clear description]" }
}
Response file (__files/[service]/[response-file].json):
{ "id": 1, "name": "Test", ... }
For each service call:
If docker-compose exists, add WireMock service: