Skip to main content
skill CX Codex

322-frameworks-spring-boot-testing-integration-tests — Claude Code

A skill for writing and reviewing Spring Boot 4.0.x integration tests: Testcontainers, persistence slices, HTTP assertions.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add jabrena/plinth --skill 322-frameworks-spring-boot-testing-integration-tests -a claude-code
Open on GitHub

What 322-frameworks-spring-boot-testing-integration-tests does

This skill sets the rules for Spring Boot 4.0.x integration tests. It draws the line between an integration test and a duplicated unit test: verify wiring and contracts, not isolated logic. Inside are guidelines for Testcontainers with @ServiceConnection for wiring without manual config, @DynamicPropertySource as a fallback for containers without built-in service connection support, and static @Container instances shared across test methods.

For HTTP you get two routes: MockMvcTester with AssertJ assertions, or TestRestTemplate for the full stack. The @DataJdbcTest and @DataJpaTest slices load only the persistence layer, so they start faster. Mocks are registered with @MockitoBean — Spring Boot 4.0.x removed @MockBean, so the skill will trip on older code. Data isolation is stated flatly: each test owns its scenario, with no shared mutable state and no ordering assumptions.

Before touching anything, the skill wants the project to compile: ./mvnw compile or mvn compile. If compilation fails, it stops there. After changes it runs ./mvnw clean verify or mvn clean verify. When the request scope is ambiguous, it stops and asks a clarifying question instead of guessing.

What it helps with

  • write @SpringBootTest tests with Testcontainers without hand-wiring the connection
  • separate integration tests from unit tests by purpose
  • speed up runs with @DataJdbcTest and @DataJpaTest slices
  • remove test dependence on execution order and shared state
  • migrate mocks from the removed @MockBean to @MockitoBean

Example prompts for the agent

  • Review my Spring Boot integration tests and tell me where I'm duplicating unit tests
  • Rewrite this test with Testcontainers and @ServiceConnection
  • Set up data isolation between tests in this class

How to install 322-frameworks-spring-boot-testing-integration-tests

1Skills CLI (Vercel)

npx skills add jabrena/plinth --skill 322-frameworks-spring-boot-testing-integration-tests -a claude-code

2Manually: put the files in place

~/.claude/skills/322-frameworks-spring-boot-testing-integration-tests/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/322-frameworks-spring-boot-testing-integration-tests/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about 322-frameworks-spring-boot-testing-integration-tests

How do I install 322-frameworks-spring-boot-testing-integration-tests in Claude?

Run npx skills add jabrena/plinth --skill 322-frameworks-spring-boot-testing-integration-tests -a claude-code. The skill lands in ~/.claude/skills/322-frameworks-spring-boot-testing-integration-tests/SKILL.md.

What does this skill do?

It provides rules and good/bad code examples for Spring Boot 4.0.x integration tests: Testcontainers, persistence slices, HTTP assertions, data isolation, and container lifecycle.

What is required before applying changes?

The skill requires compiling the project first with ./mvnw compile or mvn compile. If compilation fails, it stops and applies nothing.

Source text

SKILL.md · Apache-2.0
---
name: 322-frameworks-spring-boot-testing-integration-tests
description: Use when you need to write or improve integration tests — including Testcontainers with @ServiceConnection, @DataJdbcTest persistence slices, TestRestTemplate or MockMvcTester for HTTP, data isolation, and container lifecycle management for Spring Boot 4.0.x. This should trigger for requests such as Review Java code for Spring Boot integration tests; Apply best practices for Spring Boot integration tests in Java code; Write @SpringBootTest integration tests with Testcontainers; Configure dynamic properties for Spring integration tests; Review Spring Boot integration test profiles. Part of Plinth Toolkit
license: Apache-2.0
metadata:
  author: Juan Antonio Breña Moral
  version: 0.19.0
---
# Spring Boot Integration Testing

Apply Spring Boot integration testing guidelines for Spring Boot 4.0.x.

**What is covered in this Skill?**

- Integration test scope and purpose (verify wiring and contracts, not unit-test duplication)
- Testcontainers with @ServiceConnection for zero-config wiring (preferred)
- @DynamicPropertySource as fallback for containers without built-in service connection support
- Static @Container instances shared across test methods for performance
- MockMvcTester for fluent AssertJ-based HTTP assertions (Spring Boot 4.0.x)
- TestRestTemplate for full HTTP stack testing
- @DataJdbcTest / @DataJpaTest persistence slices (load only persistence layer, start faster)
- Data isolation: each test owns its scenario; no shared mutable state or ordering assumptions
- @MockitoBean for mock registration (Spring Boot 4.0.x — @MockBean removed)
- Resource lifecycle: Testcontainers JUnit integration for teardown; *IT / integration test separation

**Scope:** Apply recommendations based on the reference rules and good/bad code examples.

## Constraints

Before applying any integration test changes, ensure the project compiles. If compilation fails, stop immediately. After applying improvements, run full verification.

- **MANDATORY**: Run `./mvnw compile` or `mvn compile` before applying any change
- **SAFETY**: If compilation fails, stop immediately
- **VERIFY**: Run `./mvnw clean verify` or `mvn clean verify` after applying improvements
- **BEFORE APPLYING**: Read the reference for detailed rules and good/bad patterns
- **EDGE CASE**: If request scope is ambiguous, stop and ask a clarifying question before applying changes
- **EDGE CASE**: If required inputs, files, or tooling are missing, report what is missing and ask whether to proceed with setup guidance

## When to use this skill

- Review Java code for Spring Boot integration tests
- Apply best practices for Spring Boot integration tests in Java code
- Write @SpringBootTest integration tests with Testcontainers
- Configure dynamic properties for Spring integration tests
- Review Spring Boot integration test profiles

## Workflow

1. **Read reference and assess project context**

Read `references/322-frameworks-spring-boot-testing-integration-tests.md` and inspect the current project setup before proposing changes.

2. **Gather scope and decide target improvements**

Identify requested outcomes, constraints, and the minimum safe set of changes to apply.

3. **Apply framework-aligned changes**

Implement or refactor configuration/code following the reference patterns and project conventions.

4. **Run verification and report results**

Execute appropriate build/tests and summarize what changed, what was verified, and any follow-up actions.

## Reference

For detailed guidance, examples, and constraints, see [references/322-frameworks-spring-boot-testing-integration-tests.md](references/322-frameworks-spring-boot-testing-integration-tests.md).

© Juan Antonio Breña Moral · Apache-2.0 · jabrena/plinth

Similar skills

Everything for Testing and QA →

From the same set40

132-java-testing-integration-testing A skill that gets an AI agent to set up and clean up Java integration tests: WireMock stubs, per-test isolation, no mocked HTTP clients. CX Codex +1 376installs 142-java-functional-programming A skill that pushes your AI agent to rewrite Java in a functional style: Records, pure functions, Stream API pipelines and Optional. CX Codex +1 376installs 128-java-generics A skill that reviews and refactors Java generics: raw types, unchecked casts, PECS wildcards. Handy when a generic API starts leaking type safety. CX Codex +1 370installs 170-java-documentation A step-based skill that walks an agent through writing README.md, package-info.java and Javadoc for a Maven Java project. Useful when the code exists but the docs don't. CX Codex +1 359installs 030-architecture-adr-general Interactive skill that interviews developers to capture architecture decisions for Java projects in MADR format. Useful when choosing databases or framework stacks. CX Codex +1 351installs 151-java-performance-jmeter Sets up JMeter load testing in Java projects by creating a run-jmeter.sh script and standard test directories. CX Codex +1 349installs 313-frameworks-spring-db-migrations-flyway A skill for adding and reviewing Flyway migrations in Spring Boot: Maven dependencies, db/migration scripts, spring.flyway.* settings and migration ordering. CX Codex +1 352installs 162-java-profiling-analyze This skill reads the Java profiling data you already collected — flamegraphs, JFR, GC logs, thread dumps — and sorts the problems it finds by priority. CX Codex +1 350installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor