Search in sources :

Example 1 with InMemoryStubMappings

use of com.github.tomakehurst.wiremock.stubbing.InMemoryStubMappings in project wiremock by wiremock.

the class JsonFileMappingsSourceTest method loadsMappingsViaClasspathFileSource.

@Test
public void loadsMappingsViaClasspathFileSource() {
    ClasspathFileSource fileSource = new ClasspathFileSource("jar-filesource");
    JsonFileMappingsSource source = new JsonFileMappingsSource(fileSource);
    InMemoryStubMappings stubMappings = new InMemoryStubMappings();
    source.loadMappingsInto(stubMappings);
    List<StubMapping> allMappings = stubMappings.getAll();
    assertThat(allMappings, hasSize(2));
    List<String> mappingRequestUrls = asList(allMappings.get(0).getRequest().getUrl(), allMappings.get(1).getRequest().getUrl());
    assertThat(mappingRequestUrls, is(asList("/second_test", "/test")));
}
Also used : ClasspathFileSource(com.github.tomakehurst.wiremock.common.ClasspathFileSource) InMemoryStubMappings(com.github.tomakehurst.wiremock.stubbing.InMemoryStubMappings) StubMapping(com.github.tomakehurst.wiremock.stubbing.StubMapping) Test(org.junit.jupiter.api.Test)

Aggregations

ClasspathFileSource (com.github.tomakehurst.wiremock.common.ClasspathFileSource)1 InMemoryStubMappings (com.github.tomakehurst.wiremock.stubbing.InMemoryStubMappings)1 StubMapping (com.github.tomakehurst.wiremock.stubbing.StubMapping)1 Test (org.junit.jupiter.api.Test)1