Created
July 8, 2016 07:13
-
-
Save kzimnicki-zalando/98ebcf140d578b1bb74222b179d0f69e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & | |
curl http://localhost:8089/ & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.sample; | |
import com.github.tomakehurst.wiremock.WireMockServer; | |
import com.github.tomakehurst.wiremock.client.WireMock; | |
import com.github.tomakehurst.wiremock.stubbing.Scenario; | |
public class Test { | |
private static final String SCENARIO_NAME = "scenario1"; | |
private static final String FIRST_STATE = Scenario.STARTED; | |
private static final String SECOND_STATE = "2nd"; | |
public static void main(String[] args) throws InterruptedException { | |
WireMockServer server = new WireMockServer(8089); | |
server.stubFor(WireMock.get(WireMock.urlMatching("/")) | |
.inScenario(SCENARIO_NAME) | |
.whenScenarioStateIs(FIRST_STATE) | |
.willSetStateTo(SECOND_STATE) | |
.willReturn( | |
WireMock.aResponse() | |
.withBody("1\n") | |
.withStatus(200) | |
)); | |
server.stubFor(WireMock.get(WireMock.urlMatching("/")) | |
.inScenario(SCENARIO_NAME) | |
.whenScenarioStateIs(SECOND_STATE) | |
.willReturn( | |
WireMock.aResponse() | |
.withBody("2\n") | |
.withStatus(200)) | |
); | |
server.start(); | |
Thread.sleep(20 * 1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment