Package org.mockserver.matchers

Examples of org.mockserver.matchers.Times


    public void setupExpectation() throws IOException {
        // given
        MockHttpServletRequest httpServletRequest = new MockHttpServletRequest("PUT", "/expectation");
        MockHttpServletResponse httpServletResponse = new MockHttpServletResponse();
        HttpRequest httpRequest = mock(HttpRequest.class);
        Times times = mock(Times.class);
        Expectation expectation = new Expectation(httpRequest, times).thenRespond(new HttpResponse());

        String requestBytes = "requestBytes";
        httpServletRequest.setContent(requestBytes.getBytes());
        when(mockExpectationSerializer.deserialize(requestBytes)).thenReturn(expectation);
View Full Code Here


    }

    @Test
    public void shouldBuildCorrectObject() {
        // when
        Times times = new TimesDTO(Times.unlimited()).buildObject();

        // then
        assertThat(times.isUnlimited(), is(true));

        // when
        times = new TimesDTO(Times.exactly(5)).buildObject();

        // then
        assertThat(times.getRemainingTimes(), is(5));
        assertThat(times.isUnlimited(), is(false));
    }
View Full Code Here

        // given
        HttpRequest httpRequest = new HttpRequest();
        HttpResponse httpResponse = new HttpResponse();
        HttpForward httpForward = new HttpForward();
        HttpCallback httpCallback = new HttpCallback();
        Times times = Times.exactly(3);

        // when
        Expectation expectationThatResponds = new Expectation(httpRequest, times).thenRespond(httpResponse);

        // then
View Full Code Here

    public Expectation buildObject() {
        HttpRequest httpRequest = null;
        HttpResponse httpResponse = null;
        HttpForward httpForward = null;
        HttpCallback httpCallback = null;
        Times times;
        if (this.httpRequest != null) {
            httpRequest = this.httpRequest.buildObject();
        }
        if (this.httpResponse != null) {
            httpResponse = this.httpResponse.buildObject();
View Full Code Here

TOP

Related Classes of org.mockserver.matchers.Times

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.