What it does
WireMock provides configurable HTTP stubs for tests that need to simulate an API or other web service. A test can match an incoming request and return a chosen status, headers, and body, letting developers check how their application handles responses such as success, missing data, or an error. Its Java and JUnit quick start integrates the mock into a JVM test project; the core project is distinct from WireMock Cloud.
WireMock is useful when a test should control the service response instead of depending on a live third-party endpoint. In the documented Java/JUnit quick start, add WireMock to a Maven or Gradle test project, define a stub for the request your application sends, then run the application code against that local mock. The response can be authored in Java or in a JSON mapping file, so a fixed fixture can be reused across test runs.
For example, a client that reads an inventory endpoint can be tested against a stub that returns a known item and a second stub that returns an error status. The test can then assert how the client handles each case without requiring the real inventory service to be available. This checks the application's behavior against the configured examples; it does not prove that a live provider currently returns the same responses.
The core WireMock project is licensed under Apache 2.0. Its Java quick start lists Java 11 or 17 prerequisites. WireMock Cloud is a separate hosted service; its plan prices were not established in this research.
Strengths
- Stubs can match HTTP requests and return controlled response statuses, headers, and bodies for repeatable tests.
- The official Java/JUnit quick start shows Maven or Gradle integration and allows stubs to be defined in Java or JSON.
- The core service can isolate client behavior from a live or unreliable API dependency.
Watch out for
- A mock validates behavior only against the request patterns and responses you configure; it is not a substitute for checking the live API contract.
Best for
- Testing an HTTP client against predictable success and error responses
- Keeping automated tests independent from an unavailable or rate-limited external service
Sources
- WireMock Java - API Mocking for Java and JVM (Oct 25, 2026)
- Stubbing (Oct 25, 2026)
- Quick Start: API Mocking with Java and JUnit 4 (Oct 25, 2026)
- Frequently Asked Questions (Oct 25, 2026)
- LICENSE.txt (Oct 25, 2026)
