Tests
The classic pyramid: many unit tests at the base (fast and cheap), fewer integration tests in the middle and a few E2E at the top (slow and brittle). I understand the pyramid and leave it on purpose: in conveyor the default is integration, with a real Spring context, the real filter chain and PostgreSQL and RabbitMQ in Testcontainers, because that is where the bug that matters lives (query, transaction, permission). Mockito only covers what a real context cannot reach.
Decisions and why
- Pyramid base for pure rules
- A rule with no framework tests in milliseconds and the failure points at one class.
- Integration by default
- A mocked repository misses a wrong query, a constraint or a permission; a real database in a container catches them.
- Unit tests only as a last resort
- First: is the code dead? Delete it. Can a real request reach it? Integration. Only then Mockito.
- Few E2E, on the critical path
- They are slow and break for reasons that are not bugs; they only cover the flow that must not stop.
- 100% line and branch in JaCoCo
- Coverage does not prove quality, but it shows what nobody tested, and the build does not pass without it.
- The test schema is the real changelog
- The suite runs the migrations with contexts=test: a test never runs against a database production does not have.
requestresponse
Pick a scenario above to watch the message travel through the architecture.