Dev.to
7/13/2026

Integrating Specmatic Contract Testing into Spring PetClinic REST: What a "Simple" DELETE Test Taught Me About Test Architecture
Short summary
A developer integrates Specmatic contract testing into Spring PetClinic REST and discovers that contract testing exposes test infrastructure limitations, not just API bugs. Key findings include missing required foreign keys in request schemas causing DataIntegrityViolationExceptions and DELETE operations returning 404 instead of 200 due to unbounded ID path parameters. The post includes detailed code fixes using MapStruct and OpenAPI schema adjustments.
- •Specmatic contract testing on Spring PetClinic REST revealed test infrastructure gaps
- •POST /visits failures traced to missing petId foreign key in request schema
- •DELETE 404 failures caused by unbounded ID path parameters in OpenAPI spec
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



