jabrena avatar

132 Java Testing Integration Testing

This is a solid foundation for Java integration testing that pushes you toward WireMock over Mockito for HTTP mocking. It scans your imports to detect HTTP clients (Feign, Retrofit, RestTemplate), then sets up a BaseIntegrationTest with dynamic port allocation and proper stub isolation per test method. The workflow is strict about compilation checks before making changes, which will save you from breaking things. What I like here is the explicit anti-pattern list: no global stubs, no hardcoded ports, no mocking HTTP clients with Mockito. It's opinionated in a good way. Use this when you're setting up or cleaning up integration test infrastructure and want WireMock best practices baked in from the start.

skills.sh installs
128
GitHub stars
393
last updated
Jun 3, 2026

Install

$ npx -y skills add jabrena/cursor-rules-java --skill 132-java-testing-integration-testing --agent claude-code

Installs into .claude/skills of the current project.

Files

Java Integration testing guidelines

Set up robust integration-test infrastructure for Java services using WireMock to stub outbound HTTP dependencies.

What is covered in this Skill?

  • Infrastructure topology detection: scanning imports for HttpClient, feign.*, retrofit2.*, RestTemplate
  • Abstract BaseIntegrationTest base class
  • WireMockExtension with @RegisterExtension, dynamic port allocation (dynamicPort())
  • usingFilesUnderClasspath(wiremock), @BeforeAll + System.setProperty() for coordinate propagation
  • WireMock JSON mapping files (bodyFileName referencing wiremock/files/)
  • Programmatic stub registration via WireMock DSL
  • Per-test stub isolation: register stubs inside each test method
  • Fault injection: 503 service unavailable, network latency with withFixedDelay
  • Request verification via WIREMOCK.verify
  • wiremock-standalone Maven dependency (test scope)
  • Anti-patterns: global @BeforeAll stubs, Mockito-mocked HTTP clients, hardcoded ports or URLs

Scope: The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.

Constraints

Sponsors

Details

Repository
github.com/jabrena/cursor-rules-java
Categories
Testing & QA, Java & JVM
First seen
Jun 3, 2026

More from jabrena/cursor-rules-java

All 16
1absolutelyskilled avatarmobile-testingabsolutelyskilled/absolutelyskilledmobile testing125skills.sh installs
2shipshitdev avatartesting-expertshipshitdev/librarytesting expert120skills.sh installs
3erichowens avatartest-automation-experterichowens/some_claude_skillstest automation expert119skills.sh installs
4skillcreatorai avatarqa-regressionskillcreatorai/ai-agent-skillsqa regression118skills.sh installs
5laolaoshiren avatartest-generatorlaolaoshiren/claude-code-skills-zh自动生成单元测试:识别函数逻辑、覆盖边界条件、生成可运行测试代码0skills.sh installs
6storyblok avatarreview-and-qastoryblok/monoblokReview the changes for <commit|branch|pr> and create a QA review plan0skills.sh installs