finds.dev← search

// the find

hamvocke/spring-testing

★ 1,241 · Java · updated Oct 2025

A Spring Boot application with lots of test examples

A companion codebase to Martin Fowler's 'Practical Test Pyramid' article, showing a Spring Boot app tested at every level - unit, integration, contract, and end-to-end. It's for developers who want runnable examples of test pyramid concepts rather than a library to depend on.

Covers the full breadth of testing tools in one place: Mockito for mocks, WireMock for stubbing the weather API, RestAssured for HTTP-level acceptance tests, MockMvc for controller tests, and Pact for consumer-driven contract testing (the target/pacts JSON files are generated by the provider test). Each test type maps directly to a layer in the pyramid diagram in the README, so you can trace concept to code without guessing which test file demonstrates what. Tied to a widely-read Fowler article, so the reasoning behind each layer is documented outside the repo, not just in comments.

The author states outright that tests are deliberately duplicated across pyramid levels to illustrate each layer, which is the opposite of what a real test suite should do - copy code from here and you'll copy that anti-pattern too. Running it locally requires an openweathermap.org API key and a Docker Postgres container just to execute a demo, which is more setup friction than most people want for a read-through of testing patterns. It's a single frozen example app (three endpoints, one entity) with no indication of which Spring Boot or JUnit version it targets from the README, so you can't tell how current the patterns are without checking build.gradle yourself.

View on GitHub → Homepage ↗

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →