https://github.com/t1/quarkus-wiremock-demo
Demonstrates how to use the Quarkus WireMock Extension
https://github.com/t1/quarkus-wiremock-demo
Last synced: about 2 months ago
JSON representation
Demonstrates how to use the Quarkus WireMock Extension
- Host: GitHub
- URL: https://github.com/t1/quarkus-wiremock-demo
- Owner: t1
- Created: 2024-09-29T16:49:39.000Z (almost 2 years ago)
- Default Branch: trunk
- Last Pushed: 2026-03-25T21:36:27.000Z (4 months ago)
- Last Synced: 2026-03-26T20:49:26.395Z (4 months ago)
- Language: Java
- Size: 73.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
= Quarkus WireMock Extension Demo
Demonstrates how to use the https://docs.quarkiverse.io/quarkus-wiremock/dev/index.html[Quarkus WireMock Extension]... with a little helper for the mocking.
The two interesting classes are:
- https://github.com/t1/quarkus-wiremock-demo/blob/trunk/src/test/java/com/github/t1/WireMocker.java[`WireMocker`] - allows to do the stubbing a litte bit like Mockito with JAX-RS API interfaces.
Reduce boilerplate code for the mocking.
- https://github.com/t1/quarkus-wiremock-demo/blob/trunk/src/test/java/com/github/t1/NameServiceStandardMappings.java[`NameServiceStandardMappings`] - a WireMock extension that adds default stubs.
The latter would be very useful when running Quarkus in dev mode, but this doesn't work:
the extension is not loaded for the dev mode if the `META-INF/services/...Extension` file is in `src/test/resources`... OTOH we don't want to put it in `src/main/resources` because it's only for dev-testing.
Actually, Quarkus starts a _second_ `WireMock` dev-service when running the tests in dev mode.
The only solution I found, is to put mappings files in `src/test/resources/mappings/*.json`.
== Running
To see it all in action, simply run:
[source,shell]
----
mvn quarkus:dev
----
Then type `o` to see the test output, and `r` to run the tests.