LogoAwesome Skills
  • Search
  • Category
  • Tag
  • Blog
LogoAwesome Skills
LogoAwesome Skills

Discover Open-Source Agent Skills for AI Coding Assistants

Product

  • Search
  • Category
  • Tag
  • Blog

Resources

  • Claude Skill Docs
  • Antigravity Skills Docs

Tools

  • Claude Code
  • OpenCode
  • Cursor
  • Codex
  • Antigravity

Company

  • Privacy Policy
  • Terms of Service
  • Sitemap

©2026 Awesome Skills. All rights reserved.

Privacy PolicyTerms
Back to Skills

spring-boot-testing

Expert Spring Boot 4 testing specialist that selects the best Spring Boot testing techniques for your situation with Junit 6 and AssertJ.

36,373stars4,529forksUpdated 7/9/2026
Testing & QA#assertj#testcontainers#junit#spring-boot#testing#java

Security Assessment

Safe(100/100)
Security Score100/100

About spring-boot-testing

An expert guide for testing Spring Boot 4 applications with modern patterns using JUnit 6 and AssertJ. It is organized around the test pyramid - fast unit tests, focused slice tests, and complete integration tests - and the principle of choosing the narrowest slice that still gives confidence. A decision matrix maps scenarios to annotations: @WebMvcTest for controllers and HTTP semantics, @DataJpaTest for repositories and JPA queries (with Testcontainers against a real database), @RestClientTest for REST clients and external APIs, @JsonTest for JSON serialization, and @SpringBootTest for full-application tests, while plain JUnit plus Mockito covers business logic in services. The guide favors modern APIs introduced or highlighted in Spring Boot 4 - MockMvcTester for AssertJ-style web assertions, RestTestClient as the successor to TestRestTemplate, and @MockitoBean replacing the deprecated @MockBean - and points to detailed references for each tool, for AssertJ basics and collections, Testcontainers, Instancio-based test-data generation, context caching, and Spring Boot 4.0 migration. Best-practice sections address code complexity (recommending refactoring when a single method needs more than five to seven test cases), reducing redundancy with helper methods, clarifying intent with @DisplayName, and structuring tests in a consistent order - happy path first, then alternative paths and edge cases, then exceptions and error conditions. It advises writing tests around realistic production scenarios and targeting roughly 80% coverage as a practical balance, tracked with the Jacoco Maven plugin, while prioritizing business-critical paths, complex algorithms, error handling, and integration points. Required test dependencies for Spring Boot 4, including the web-mvc test starter and the Testcontainers starter, are listed so a project can adopt the recommended stack quickly.

FAQ

Which test slice should I use for a controller endpoint?

Use @WebMvcTest with MockMvcTester for the web layer and HTTP semantics.

What replaces @MockBean in Spring Boot 4?

@MockitoBean replaces the deprecated @MockBean for mocking dependencies.

How do I test repository queries?

Use @DataJpaTest together with Testcontainers so the queries run against a real database rather than an in-memory substitute.

What code coverage target does it recommend?

Aim for about 80% coverage as a practical balance, tracked with the Jacoco Maven plugin, while prioritizing business-critical paths, complex algorithms, and error handling.

In what order should tests be structured?

Main scenario (the happy path) first, then other valid paths and edge cases, and finally exceptions and error conditions.

All Files

15 files
references/assertj-collections.md4.9 KB
View
references/mockmvc-classic.md5.8 KB
View
references/test-slices-overview.md5.4 KB
View
references/datajpatest.md4.8 KB
View
references/instancio.md4.8 KB
View
references/resttestclient.md4.9 KB
View
SKILL.md6.5 KB
View
references/assertj-basics.md4.3 KB
View
references/mockitobean.md4.5 KB
View
references/sb4-migration.md3.3 KB
View
references/context-caching.md2.4 KB
View
references/mockmvc-tester.md7.5 KB
View
references/testcontainers-jdbc.md5.3 KB
View
references/restclienttest.md4.6 KB
View
references/webmvctest.md3.6 KB
View

Install spring-boot-testing

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill

Repository

github/awesome-copilot

Related Skills

dbt-sf-to-bq-translator

21,076

build-models

102

html-prototype

3,588

doc

448