Package com.github.tomakehurst.wiremock.stubbing

Examples of com.github.tomakehurst.wiremock.stubbing.ListStubMappingsResult


public class RootTask implements AdminTask {

    @Override
    public ResponseDefinition execute(Admin admin, Request request) {
        ListStubMappingsResult result = admin.listAllStubMappings();
        return ResponseDefinitionBuilder.jsonResponse(result);
    }
View Full Code Here


    @Test
    public void listingAllStubMappings() {
        stubFor(get(urlEqualTo("/stub/one")).willReturn(aResponse().withBody("One")));
        stubFor(post(urlEqualTo("/stub/two")).willReturn(aResponse().withBody("Two").withStatus(201)));

        ListStubMappingsResult listingResult = listAllStubMappings();
        StubMapping mapping1 = listingResult.getMappings().get(0);
        assertThat(mapping1.getRequest().getMethod(), is(POST));
        assertThat(mapping1.getRequest().getUrl(), is("/stub/two"));
        assertThat(mapping1.getResponse().getBody(), is("Two"));
        assertThat(mapping1.getResponse().getStatus(), is(201));

        StubMapping mapping2 = listingResult.getMappings().get(1);
        assertThat(mapping2.getRequest().getMethod(), is(GET));
        assertThat(mapping2.getRequest().getUrl(), is("/stub/one"));
        assertThat(mapping2.getResponse().getBody(), is("One"));
    }
View Full Code Here

        stubMappings.addMapping(stubMapping);
    }

    @Override
    public ListStubMappingsResult listAllStubMappings() {
        return new ListStubMappingsResult(stubMappings.getAll());
    }
View Full Code Here

TOP

Related Classes of com.github.tomakehurst.wiremock.stubbing.ListStubMappingsResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.