Case study
Vendor API Simulator
A template-driven simulator of external vendor APIs that let teams develop, test and demo against realistic responses without any patient data.
Architect Testing Developer Experience Groovy Spring Boot
flowchart LR
client("Client")
subgraph Application["Application"]
subgraph rh["Request Handler"]
tl("Template Lookup")
context@{ shape: subproc, label: "Build Context" }
end
subgraph gc["Groovy Context"]
template[/"Template"/]
fds[/"Freeform Data Store"/]
payload@{ shape: manual-input, label: "Payload" }
end
subgraph pe["Processing Engine"]
direction TB
pt@{ shape: subproc, label: "Process Template" }
csl@{ shape: subproc, label: "Custom Script Logic" }
prdr[/"Prepared Response"/]
pt --> csl --> prdr
end
DB@{ shape: cyl, label: "Database" }
end
client <==>|request / response| rh
client ~~~ DB
tl --> context
DB -.-> tl
DB -.->|templates & data| context
context --> gc
gc o-.-o pe
rh <==>|process / prepared response| pe
style rh fill:#FFFFFF,stroke:#DCDED7
style gc fill:#FFFFFF,stroke:#656963,stroke-dasharray: 5 5
style pe fill:#FFFFFF,stroke:#DCDED7
classDef accent fill:#0047FF,stroke:#0036C2,color:#FFFFFF
class pt accent
Background
A healthcare application integrated with several external vendors to exchange patient and eligibility information. Development, testing and product demos all depended on responses from those vendor APIs, and real responses carry protected health information (PHI). The company was in startup mode, so the answer had to be simple, internal and quick to build, and it had to make it impossible for real patient data to leak by accident.
Problem
- Real responses contain PHI — Building and testing against live vendor responses put patient data in front of developers, testers and demo audiences.
- Every vendor speaks a different language — The vendor interfaces were the contract, and they varied widely: SOAP, REST, custom XML and EDI 270/271 eligibility transactions.
- Scenarios change constantly — Users needed to change a single value in a response with minimal effort, and to swap in a whole new response for a new use-case variant.
- No safe way to reproduce edge cases — Exercising the main application’s business logic across many data variations was hard when the data came from systems outside the team’s control.
Solution
I designed and built an internal simulator that mimicked each vendor’s API, driven by templates stored in a database.
- Templates as the contract — Each vendor’s input format defined the contract. The simulator accepted the same requests the vendor would, and answered in the vendor’s format.
- Request-to-template lookup — A lookup model mapped each incoming request to a template, so every synthetic patient represented a specific use case.
- Groovy template engine — Responses were built dynamically from request payload values, the current date and time, and custom data sets.
- Custom data sets — Tables with typed columns held varied test data, looked up by configurable keys built from payload values or set inside the Groovy script.
- Multi-format support — SOAP, custom XML, EDI 270/271 and REST, with three vendors integrated, each with complex data sets.
- Ad-hoc endpoints — Any GET or POST endpoint could be simulated on demand, managed in the database with fully customizable response processing.
- No rebuild to change behaviour — Templates, scripts and data sets lived in a relational database, so responses could change without a rebuild or redeploy.
Why Groovy. The simulator was a Spring Boot application, and Groovy runs on the JVM, so it was a natural fit. Responses were rendered with Groovy’s template engine. The application’s lookup APIs and data access were available directly in the script context, and Groovy’s JSON and XML handling, along with the application’s own libraries, could be used from any template.
Outcome
- Zero PHI in development and testing — Teams build, test and validate scenarios on synthetic data, including in local development environments.
- Hundreds of scenarios on demand — Hundreds of fake patients and input combinations cover hundreds of use-case variants.
- Private by design — The simulator is deployed only in non-production environments, alongside DEV and QA, so test data stays internal.
- Faster troubleshooting — Teams can reproduce and debug the main application’s business logic across many data variations without waiting on a vendor.
- Still in use years later — Internal product teams still rely on it for development work, and it runs behind the scenes in demos and live presentations.