Testing dependencies for WireMock test framework.
This module provides a Junit 5 extension to set up Wiremock for your tests.
Useful for setting up Wiremock for each one of your tests.
Example:
class WireMockExtensionTest {
@RegisterExtension
WireMockExtension wire = new WireMockExtension();
@BeforeEach
void before() {
wire.stubFor(
get("/api/cars") // NOSONAR
.withHeader("Accept", notMatching("gzip"))
.willReturn(ok().withHeader("Content-type", "application/json").withBody("[]")));
}
// Tests
}
Useful for setting up Wiremock once for your test class.
Example:
class WireMockClassExtensionTest {
@RegisterExtension
public static WireMockClassExtension wire =
new WireMockClassExtension();
@BeforeAll
public static void beforeAll() {
wire.stubFor(
get("/api/cars") // NOSONAR
.withHeader("Accept", notMatching("gzip"))
.willReturn(ok().withHeader("Content-type", "application/json").withBody("[]")));
}
// Tests
}