StableMock Examples Library

Browse a comprehensive collection of copy-paste ready examples for StableMock. From strict REST mocking to complex GraphQL and SOAP scenarios.

Don't reinvent the wheel. Browse our curated collection of integration testing patterns. Every example is production-ready and fully tested in our CI pipeline.

Getting Started

Spring Boot REST Basics

Basic Spring Boot Test

The 'Hello World' of integration testing. Mocks a simple JSON GET request using RestTemplate.

JUnit 5 Performance No-Framework

Pure JUnit 5 (No Spring)

Lightweight mocking without the Spring Context overhead. Uses parameter injection for the port.

Advanced Protocols

GraphQL Body Matching

GraphQL Mocking

Matches GraphQL queries by body content. handles variables and specific operation names.

XML SOAP Legacy

XML & SOAP Services

Auto-detects SOAP envelopes and generates namespace-agnostic XPath matchers.

Complex Scenarios

Smart Matching Automation

Dynamic Field Handling

Automatically detects and ignores changing fields like Timestamps, UUIDs, and Random Tokens.

Microservices Architecture

Multi-Service Orchestration

Mocks multiple distinct upstream APIs (User Service + Audit Service) in a single test.

Scenarios Pagination

Stateful Pagination

Simulates state with 'scenario=true'. Returns Page 1, then Page 2 for sequential calls.

Want to contribute an example?

We love seeing how developers use StableMock in the wild. Submit a PR to our examples repo.

Submit on GitHub

Stop Rewriting Mocks By Hand, Son

Record once. Test offline forever.

Join developers who've made the switch. Free forever. No credit card required.

🌾 MIT License | 🚀 Open Source | 💯 Free Forever