se.bjurr.wiremockpact.wiremockpactextension.WireMockPactExtension Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wiremock-pact-extension Show documentation
Show all versions of wiremock-pact-extension Show documentation
Transform Wiremock mappings to PACT.
The newest version!
package se.bjurr.wiremockpact.wiremockpactextension;
import com.github.tomakehurst.wiremock.extension.Parameters;
import com.github.tomakehurst.wiremock.extension.ServeEventListener;
import com.github.tomakehurst.wiremock.stubbing.ServeEvent;
import se.bjurr.wiremockpact.wiremockpactextension.support.BaseSetupJunitExtension;
import se.bjurr.wiremockpact.wiremockpactlib.api.WireMockPactApi;
import se.bjurr.wiremockpact.wiremockpactlib.api.WireMockPactConfig;
public class WireMockPactExtension extends BaseSetupJunitExtension implements ServeEventListener {
private final WireMockPactApi wiremockPactApi;
public WireMockPactExtension(final WireMockPactConfig config) {
super();
this.wiremockPactApi = WireMockPactApi.create(config);
}
@Override
public String getName() {
return WireMockPactExtension.class.getSimpleName();
}
@Override
public void afterComplete(final ServeEvent serveEvent, final Parameters parameters) {
this.wiremockPactApi.addServeEvent(serveEvent);
}
@Override
public void setup() {
this.wiremockPactApi.clearAllSaved();
}
@Override
public void close() throws Throwable {
this.wiremockPactApi.saveAll();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy