use of com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource in project wiremock by wiremock.
the class MappingsLoaderAcceptanceTest method loadsStubMappingsFromAMixtureOfSingleAndMultiStubFiles.
@Test
public void loadsStubMappingsFromAMixtureOfSingleAndMultiStubFiles() {
buildWireMock(configuration);
wireMockServer.resetMappings();
wireMockServer.loadMappingsUsing(new JsonFileMappingsSource(new SingleRootFileSource(filePath("multi-stub"))));
List<StubMapping> stubs = wireMockServer.listAllStubMappings().getMappings();
assertThat(stubs.size(), is(4));
assertThat(stubs, hasItem(stubMappingWithUrl("/single/1")));
assertThat(stubs, hasItem(stubMappingWithUrl("/multi/1")));
assertThat(stubs, hasItem(stubMappingWithUrl("/multi/2")));
assertThat(stubs, hasItem(stubMappingWithUrl("/multi/3")));
}
use of com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource in project wiremock by wiremock.
the class MappingsLoaderAcceptanceTest method mappingsLoadedFromJsonFiles.
@Test
public void mappingsLoadedFromJsonFiles() {
buildWireMock(configuration);
wireMockServer.loadMappingsUsing(new JsonFileMappingsSource(new SingleRootFileSource(filePath("test-requests"))));
WireMockResponse response = testClient.get("/canned/resource/1");
assertThat(response.statusCode(), is(200));
response = testClient.get("/canned/resource/2");
assertThat(response.statusCode(), is(401));
}
Aggregations