test: WireMockExtension response header
This commit is contained in:
parent
157a1ebe68
commit
9e69a47b3e
1 changed files with 6 additions and 1 deletions
|
@ -14,7 +14,10 @@ public class WireMockExtension implements BeforeAllCallback, AfterEachCallback,
|
|||
|
||||
public static void response(String endpoint, int status, String body) {
|
||||
configureFor(38080);
|
||||
stubFor(get(urlEqualTo(endpoint)).willReturn(WireMock.status(status).withBody(body)));
|
||||
stubFor(get(urlEqualTo(endpoint))
|
||||
.willReturn(WireMock.status(status)
|
||||
.withHeader("Content-Type", "application/json")
|
||||
.withBody(body)));
|
||||
}
|
||||
|
||||
public static void verifyGet(int count, String url) {
|
||||
|
@ -34,6 +37,8 @@ public class WireMockExtension implements BeforeAllCallback, AfterEachCallback,
|
|||
@Override
|
||||
public void afterEach(ExtensionContext extensionContext) throws Exception {
|
||||
wireMockServer.listAllStubMappings().getMappings().forEach(wireMockServer::removeStub);
|
||||
wireMockServer.findAllUnmatchedRequests().forEach(System.out::println);
|
||||
wireMockServer.resetRequests();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue