Spring testing tools isolate object, container and HTTP contracts through selected fixtures.
Learning roadmap
Read the contract, run the source-kit checks, and inspect a rejected input before extending the application. This subject covers Spring and Spring Boot together; Java language lessons remain in their own subject.
Prerequisites
Use Java object ownership, interfaces, exceptions and Maven builds before the framework-specific lessons.
Section lessons
- Spring MockMvc tests: HTTP behavior without claiming a real network test
- Spring tests: separate business rules, wiring and transport
- Spring ApplicationContextRunner: check conditional assembly in isolation
- Spring MockMvc standalone tests: know which HTTP layers were assembled
- Spring test failures: prove the layer that can reject the request
- Test a Spring worker at admission, lease and replay boundaries
- Test Spring JWT authorization through filters, service proxy and SQL
- Spring command rollback test: inspect state after an injected failure
- Spring MockMvc multipart tests: what the fixture proves
- Spring relay failure trace: inspect persisted state at each cut point
- Spring relay integration tests: prove the boundaries H2 cannot
- Spring schema rollout tests: check old and new writers at every phase
- Spring Boot migration tests: distinguish a test starter from a runtime rollout
- Spring release tests: distinguish context checks from process and platform checks
- Test Spring RestClient on a socket without claiming a remote service
- Spring Boot config tests: what a child JVM proves and what deployment still owes
- Spring Boot file-tree tests: prove binding without claiming secret delivery
Continue learning
Boot Foundations, Spring Core, Web APIs, Data & Transactions, Security, Production, Exercises, Quizzes, Projects.
Kafka verification layers
GraphQL test scope
R2DBC dependency and test scope
Spring AI boundary lessons
Modulith module and event boundaries
- Spring Modulith verification: a compiling internal import still fails architecture checks
- Spring Modulith module tests: distinguish structure verification from a sliced context
Batch fault handling
Modulith event and module tests
- Spring Modulith module slices: start inventory without dispatch
- Spring Modulith PublishedEvents: assert an accepted fact and a rejected silence
Batch recovery and rejected-row review
Batch metadata and hard-stop recovery
Testcontainers connection lifecycle
Container schema and test isolation
- Spring Boot Testcontainers and Flyway: let one owner prepare the test schema
- Spring Testcontainers parallel tests: one database can leak another test's rows
Spring testing boundaries
- Spring Data JPA test: flush and clear before trusting a read
- Spring Data JPA test against the deployment database dialect
- Spring Boot HTTP test: client rollback does not own server writes
- Spring MockMvc security test: run the application filter chain
- Spring TestContext cache: keep equivalent tests on one context shape
- Spring @MockitoBean override: a mock can remove advice from the tested bean
- Spring transactional event test: cross an actual commit boundary
- Spring scheduled worker test: inject a clock and call the work once
Test slice and transaction boundaries
- Spring @WebMvcTest: replace collaborators without claiming a full application
- Spring MockMvc async dispatch: assert the final response after resumed handling
- Spring @DynamicPropertySource: bind test resources without stale cached values
- Spring @Sql fixtures: decide whether setup commits outside the test rollback
- Spring @DirtiesContext: evict only a context a test truly changed
- Spring RestClient mock server: assert outgoing request shape before socket tests
- Spring WebTestClient target: distinguish mock binding from a running port
- Spring transactional tests: preemptive timeouts can escape rollback
