Short answer: Stubs are a code-level description of the responses; contract tests verify the responses against the schema. The first tells the mock what to return; the second proves the real response is valid. They are different stages and both belong in a pipeline.

What stubs provide

Controlled responses for the tests, so the system can be exercised without the real service. They are authored and can drift.

What contract tests provide

PropertyStubsContract tests
SubjectMock responsesReal responses
AuthorityStub codeSchema
Catches driftNot directlyYes
StageIsolationVerification

Why the stages matter

A stub lets the system run without the dependency; a contract test proves the dependency still conforms. Replacing one with the other leaves a gap.

The honest takeaway

Keep the stubs for isolation and the contract checks for conformance. A spec-first studio keeps both tied to the same source.

This is part of the Powerduck vs WireMock comparison. Next, read beyond JVM mocking.