Package org.mockserver.mock

Examples of org.mockserver.mock.Expectation


                "    \"unlimited\" : false" + System.getProperty("line.separator") +
                "  }" + System.getProperty("line.separator") +
                "}");

        // when
        Expectation expectation = new ExpectationSerializer().deserialize(requestBytes);

        // then
        assertEquals(new ExpectationDTO()
                        .setHttpRequest(
                                new HttpRequestDTO()
View Full Code Here


                "    \"unlimited\" : false" + System.getProperty("line.separator") +
                "  }" + System.getProperty("line.separator") +
                "}");

        // when
        Expectation expectation = new ExpectationSerializer().deserialize(requestBytes);

        // then
        assertEquals(new ExpectationDTO()
                        .setHttpRequest(
                                new HttpRequestDTO()
View Full Code Here

                "        \"body\": \"someBody\"" + System.getProperty("line.separator") +
                "    }" + System.getProperty("line.separator") +
                "}");

        // when
        Expectation expectation = new ExpectationSerializer().deserialize(requestBytes);

        // then
        assertEquals(new ExpectationDTO()
                .setHttpRequest(
                        new HttpRequestDTO()
View Full Code Here

                "        \"body\": \"someBody\"" + System.getProperty("line.separator") +
                "    }" + System.getProperty("line.separator") +
                "}");

        // when
        Expectation expectation = new ExpectationSerializer().deserialize(requestBytes);

        // then
        assertEquals(new ExpectationDTO()
                .setHttpRequest(
                        new HttpRequestDTO()
View Full Code Here

                "        \"body\": \"someBody\"" + System.getProperty("line.separator") +
                "    }" + System.getProperty("line.separator") +
                "}");

        // when
        Expectation expectation = new ExpectationSerializer().deserialize(requestBytes);

        // then
        assertEquals(new ExpectationDTO()
                .setHttpRequest(
                        new HttpRequestDTO()
View Full Code Here

    }

    @Test
    public void shouldSerializePartialExpectationArray() throws IOException {
        // when
        Expectation expectation = new ExpectationDTO()
                .setHttpRequest(
                        new HttpRequestDTO()
                                .setPath("somePath")
                )
                .setHttpResponse(
View Full Code Here

        logFilter.onResponse(httpRequest, httpResponseThree);

        // then
        assertArrayEquals(logFilter.retrieve(null),
                new Expectation[]{
                        new Expectation(httpRequest, Times.once()).thenRespond(httpResponseOne),
                        new Expectation(httpRequest, Times.once()).thenRespond(httpResponseThree),
                        new Expectation(otherHttpRequest, Times.once()).thenRespond(httpResponseTwo)
                });
        assertArrayEquals(logFilter.retrieve(new HttpRequest()),
                new Expectation[]{
                        new Expectation(httpRequest, Times.once()).thenRespond(httpResponseOne),
                        new Expectation(httpRequest, Times.once()).thenRespond(httpResponseThree),
                        new Expectation(otherHttpRequest, Times.once()).thenRespond(httpResponseTwo)
                });
        assertArrayEquals(logFilter.retrieve(new HttpRequest().withPath("some_path")),
                new Expectation[]{
                        new Expectation(httpRequest, Times.once()).thenRespond(httpResponseOne),
                        new Expectation(httpRequest, Times.once()).thenRespond(httpResponseThree)
                });
        assertArrayEquals(logFilter.retrieve(new HttpRequest().withPath("some_other_path")),
                new Expectation[]{
                        new Expectation(otherHttpRequest, Times.once()).thenRespond(httpResponseTwo)
                });
    }
View Full Code Here

    public void shouldDumpAllToLogAsJSONForNull() {
        // when
        logFilter.dumpToLog(null, false);

        // then
        verify(logger).warn(new ExpectationSerializer().serialize(new Expectation(httpRequest, Times.once()).thenRespond(httpResponseOne)));
        verify(logger).warn(new ExpectationSerializer().serialize(new Expectation(httpRequest, Times.once()).thenRespond(httpResponseThree)));
        verify(logger).warn(new ExpectationSerializer().serialize(new Expectation(otherHttpRequest, Times.once()).thenRespond(httpResponseTwo)));
        verifyNoMoreInteractions(logger);
    }
View Full Code Here

    public void shouldDumpAllToLogAsJavaForNull() {
        // when
        logFilter.dumpToLog(null, true);

        // then
        verify(logger).warn(new ExpectationSerializer().serializeAsJava(new Expectation(httpRequest, Times.once()).thenRespond(httpResponseOne)));
        verify(logger).warn(new ExpectationSerializer().serializeAsJava(new Expectation(httpRequest, Times.once()).thenRespond(httpResponseThree)));
        verify(logger).warn(new ExpectationSerializer().serializeAsJava(new Expectation(otherHttpRequest, Times.once()).thenRespond(httpResponseTwo)));
        verifyNoMoreInteractions(logger);
    }
View Full Code Here

    public void shouldDumpAllToLogAsJSONIfMatchAll() {
        // when
        logFilter.dumpToLog(new HttpRequest(), false);

        // then
        verify(logger).warn(new ExpectationSerializer().serialize(new Expectation(httpRequest, Times.once()).thenRespond(httpResponseOne)));
        verify(logger).warn(new ExpectationSerializer().serialize(new Expectation(httpRequest, Times.once()).thenRespond(httpResponseThree)));
        verify(logger).warn(new ExpectationSerializer().serialize(new Expectation(otherHttpRequest, Times.once()).thenRespond(httpResponseTwo)));
        verifyNoMoreInteractions(logger);
    }
View Full Code Here

TOP

Related Classes of org.mockserver.mock.Expectation

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.