{"id":"4e0b1fb6-377d-44f5-9e79-8930a40c3b61","shortId":"QQ8bUj","kind":"skill","title":"132-java-testing-integration-testing","tagline":"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(), cre","description":"# Java Integration testing guidelines\n\nSet up robust integration-test infrastructure for Java services using WireMock to stub outbound HTTP dependencies.\n\n**What is covered in this Skill?**\n\n- Infrastructure topology detection: scanning imports for `HttpClient`, `feign.*`, `retrofit2.*`, `RestTemplate`\n- Abstract `BaseIntegrationTest` base class\n- `WireMockExtension` with `@RegisterExtension`, dynamic port allocation (`dynamicPort()`)\n- `usingFilesUnderClasspath(wiremock)`, `@BeforeAll` + `System.setProperty()` for coordinate propagation\n- WireMock JSON mapping files (`bodyFileName` referencing `wiremock/files/`)\n- Programmatic stub registration via WireMock DSL\n- Per-test stub isolation: register stubs inside each test method\n- Fault injection: 503 service unavailable, network latency with `withFixedDelay`\n- Request verification via `WIREMOCK.verify`\n- `wiremock-standalone` Maven dependency (test scope)\n- Anti-patterns: global `@BeforeAll` stubs, Mockito-mocked HTTP clients, hardcoded ports or URLs\n\n**Scope:** The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.\n\n## Constraints\n\nBefore 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.\n\n- **MANDATORY**: Run `./mvnw compile` or `mvn compile` before applying any change\n- **SAFETY**: If compilation fails, stop immediately and do not proceed — compilation failure is a blocking condition\n- **VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after applying improvements\n- **BEFORE APPLYING**: Read the reference for detailed examples, good/bad patterns, and constraints\n\n## When to use this skill\n\n- Review Java code for integration tests\n- Apply best practices for integration tests in Java code\n\n## Workflow\n\n1. **Compile project before integration-test changes**\n\nRun `./mvnw compile` or `mvn compile` and stop immediately if compilation fails.\n\n2. **Read integration-testing reference and detect topology**\n\nRead `references/132-java-testing-integration-testing.md` and detect HTTP client and external dependency integration points.\n\n3. **Set up resilient integration-test infrastructure**\n\nImplement BaseIntegrationTest, WireMock mappings/stubs, per-test isolation, and verification patterns.\n\n4. **Verify with full build**\n\nRun `./mvnw clean verify` or `mvn clean verify` after applying improvements.\n\n## Reference\n\nFor detailed guidance, examples, and constraints, see [references/132-java-testing-integration-testing.md](references/132-java-testing-integration-testing.md).","tags":["132","java","testing","integration","cursor","rules","jabrena","agent-skills","ai-skills","claude","claude-code","claude-code-skills"],"capabilities":["skill","source-jabrena","skill-132-java-testing-integration-testing","topic-agent-skills","topic-ai-skills","topic-claude","topic-claude-code","topic-claude-code-skills","topic-claude-code-subagents","topic-claude-skills","topic-cursor-agent","topic-cursor-ai","topic-cursor-skills","topic-cursorai","topic-github-copilot"],"categories":["cursor-rules-java"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/jabrena/cursor-rules-java/132-java-testing-integration-testing","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add jabrena/cursor-rules-java","source_repo":"https://github.com/jabrena/cursor-rules-java","install_from":"skills.sh"}},"qualityScore":"0.631","qualityRationale":"deterministic score 0.63 from registry signals: · indexed on github topic:agent-skills · 362 github stars · SKILL.md body (2,681 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-26T12:53:35.302Z","embedding":null,"createdAt":"2026-04-18T22:02:01.001Z","updatedAt":"2026-04-26T12:53:35.302Z","lastSeenAt":"2026-04-26T12:53:35.302Z","tsv":"'/mvnw':206,233,285,341 '1':276 '132':1 '2':296 '3':316 '4':335 '503':124 'abstract':80 'alloc':89 'anti':143 'anti-pattern':142 'appli':171,179,199,212,241,244,266,349 'applic':175 'area':170 'base':82,173 'baseintegrationtest':81,325 'baseintegrationtest.java':23 'beforeal':93,146 'best':267 'block':229 'bodyfilenam':102 'build':339 'chang':183,214,283 'class':83 'clean':234,238,342,346 'client':31,152,310 'code':165,262,274 'compil':187,189,207,210,217,225,277,286,289,294 'condit':230 'constraint':177,254,357 'coordin':38,96 'core':169 'cover':66 'cre':42 'depend':63,139,313 'detail':249,353 'detect':29,72,303,308 'dsl':110 'dynam':39,87 'dynamicport':90 'ensur':184 'exampl':163,176,250,355 'extern':312 'fail':190,218,295 'failur':226 'fault':122 'feign':77 'file':101 'full':202,338 'generat':21 'global':145 'good/bad':164,251 'guidanc':354 'guidelin':46 'hardcod':153 'http':27,30,62,151,309 'httpclient':76 'immedi':192,220,292 'implement':324 'import':34,74 'improv':16,200,242,350 'includ':20 'infrastructur':32,53,70,323 'inject':36,123 'insid':118 'integr':5,18,44,51,181,264,270,281,299,314,321 'integration-test':50,280,298,320 'isol':115,331 'java':3,17,43,55,261,273 'java-testing-integration-test':2 'json':99 'latenc':128 'mandatori':204 'map':100 'mappings/stubs':327 'maven':138 'method':121 'mock':150 'mockito':149 'mockito-mock':148 'mvn':209,237,288,345 'need':10 'network':127 'organ':161 'outbound':61 'pattern':144,166,252,334 'per':112,329 'per-test':111,328 'point':315 'port':88,154 'practic':268 'proceed':195,224 'programmat':105 'project':186,278 'propag':97 'read':245,297,305 'recommend':172 'refer':159,247,301,351 'referenc':103 'references/132-java-testing-integration-testing.md':306,359,360 'regist':116 'registerextens':86 'registr':107 'request':131 'resili':319 'resolv':197 'resttempl':79 'retrofit2':78 'review':14,260 'robust':49 'run':201,205,232,284,340 'safeti':215 'scan':73 'scope':141,157 'see':358 'servic':37,56,125 'set':12,47,317 'signal':35 'skill':69,259 'skill-132-java-testing-integration-testing' 'source-jabrena' 'standalon':137 'stop':191,219,291 'stub':28,60,106,114,117,147 'system.setproperty':41,94 'test':4,6,19,45,52,113,120,140,182,265,271,282,300,322,330 'topic-agent-skills' 'topic-ai-skills' 'topic-claude' 'topic-claude-code' 'topic-claude-code-skills' 'topic-claude-code-subagents' 'topic-claude-skills' 'topic-cursor-agent' 'topic-cursor-ai' 'topic-cursor-skills' 'topic-cursorai' 'topic-github-copilot' 'topolog':71,304 'unavail':126 'url':156 'use':7,57,257 'usingfilesunderclasspath':91 'verif':132,203,333 'verifi':231,235,239,336,343,347 'via':40,108,133 'wiremock':25,58,92,98,109,136,326 'wiremock-standalon':135 'wiremock.verify':134 'wiremock/files':104 'wiremockextens':84 'withfixeddelay':130 'workflow':275","prices":[{"id":"f1f038ec-ebd0-46bf-9d30-be739ad0f47c","listingId":"4e0b1fb6-377d-44f5-9e79-8930a40c3b61","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"jabrena","category":"cursor-rules-java","install_from":"skills.sh"},"createdAt":"2026-04-18T22:02:01.001Z"}],"sources":[{"listingId":"4e0b1fb6-377d-44f5-9e79-8930a40c3b61","source":"github","sourceId":"jabrena/cursor-rules-java/132-java-testing-integration-testing","sourceUrl":"https://github.com/jabrena/cursor-rules-java/tree/main/skills/132-java-testing-integration-testing","isPrimary":false,"firstSeenAt":"2026-04-18T22:02:01.001Z","lastSeenAt":"2026-04-26T12:53:35.302Z"}],"details":{"listingId":"4e0b1fb6-377d-44f5-9e79-8930a40c3b61","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"jabrena","slug":"132-java-testing-integration-testing","github":{"repo":"jabrena/cursor-rules-java","stars":362,"topics":["agent-skills","ai-skills","claude","claude-code","claude-code-skills","claude-code-subagents","claude-skills","cursor-agent","cursor-ai","cursor-skills","cursorai","github-copilot","intellij-idea","java","prompting","system-prompts"],"license":"apache-2.0","html_url":"https://github.com/jabrena/cursor-rules-java","pushed_at":"2026-04-26T12:50:01Z","description":"A curated and opinionated collection of Skills and Agents to be used in modern SDLC workflows for Java Enterprise development with your favorite AI Agent harness.","skill_md_sha":"794b9b81ff81f4702634cf0751f1c8cab5f4663e","skill_md_path":"skills/132-java-testing-integration-testing/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/jabrena/cursor-rules-java/tree/main/skills/132-java-testing-integration-testing"},"layout":"multi","source":"github","category":"cursor-rules-java","frontmatter":{"name":"132-java-testing-integration-testing","license":"Apache-2.0","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. Part of cursor-rules-java project"},"skills_sh_url":"https://skills.sh/jabrena/cursor-rules-java/132-java-testing-integration-testing"},"updatedAt":"2026-04-26T12:53:35.302Z"}}