Package org.mockserver.client.serialization.model

Examples of org.mockserver.client.serialization.model.ExpectationDTO


    @Test
    public void shouldVerify() throws UnsupportedEncodingException {
        // given
        when(mockApacheHttpClient.sendPUTRequest(anyString(), anyString(), anyString())).thenReturn("body");
        when(expectationSerializer.deserializeArray(anyString())).thenReturn(new Expectation[]{
                new ExpectationDTO().buildObject(),
                new ExpectationDTO().buildObject()
        });

        // when
        proxyClient
                .verify(
View Full Code Here


    @Test
    public void shouldVerifyOneRequestCount() throws UnsupportedEncodingException {
        // given
        when(mockApacheHttpClient.sendPUTRequest(anyString(), anyString(), anyString())).thenReturn("body");
        when(expectationSerializer.deserializeArray(anyString())).thenReturn(new Expectation[]{
                new ExpectationDTO().buildObject()
        });

        // when
        proxyClient
                .verify(
View Full Code Here

    @Test(expected = AssertionError.class)
    public void shouldVerifyNotOneRequestCount() throws UnsupportedEncodingException {
        // given
        when(mockApacheHttpClient.sendPUTRequest(anyString(), anyString(), anyString())).thenReturn("body");
        when(expectationSerializer.deserializeArray(anyString())).thenReturn(new Expectation[]{
                new ExpectationDTO().buildObject(),
                new ExpectationDTO().buildObject()
        });

        // when
        proxyClient
                .verify(
View Full Code Here

    @Test
    public void shouldVerifyExactRequestCount() throws UnsupportedEncodingException {
        // given
        when(mockApacheHttpClient.sendPUTRequest(anyString(), anyString(), anyString())).thenReturn("body");
        when(expectationSerializer.deserializeArray(anyString())).thenReturn(new Expectation[]{
                new ExpectationDTO().buildObject()
        });

        // when
        proxyClient
                .verify(
View Full Code Here

    @Test(expected = AssertionError.class)
    public void shouldVerifyNotExactRequestCount() throws UnsupportedEncodingException {
        // given
        when(mockApacheHttpClient.sendPUTRequest(anyString(), anyString(), anyString())).thenReturn("body");
        when(expectationSerializer.deserializeArray(anyString())).thenReturn(new Expectation[]{
                new ExpectationDTO().buildObject(),
                new ExpectationDTO().buildObject()
        });

        // when
        proxyClient
                .verify(
View Full Code Here

    @Test
    public void shouldVerifyAtLeastRequestCountAllowExactMatch() throws UnsupportedEncodingException {
        // given
        when(mockApacheHttpClient.sendPUTRequest(anyString(), anyString(), anyString())).thenReturn("body");
        when(expectationSerializer.deserializeArray(anyString())).thenReturn(new Expectation[]{
                new ExpectationDTO().buildObject()
        });

        // when
        proxyClient
                .verify(
View Full Code Here

    @Test
    public void shouldVerifyAtLeastRequestCountAllowsMoreThen() throws UnsupportedEncodingException {
        // given
        when(mockApacheHttpClient.sendPUTRequest(anyString(), anyString(), anyString())).thenReturn("body");
        when(expectationSerializer.deserializeArray(anyString())).thenReturn(new Expectation[]{
                new ExpectationDTO().buildObject(),
                new ExpectationDTO().buildObject(),
                new ExpectationDTO().buildObject()
        });

        // when
        proxyClient
                .verify(
View Full Code Here

    @Test(expected = AssertionError.class)
    public void shouldVerifyNotAtLeastRequestCount() throws UnsupportedEncodingException {
        // given
        when(mockApacheHttpClient.sendPUTRequest(anyString(), anyString(), anyString())).thenReturn("body");
        when(expectationSerializer.deserializeArray(anyString())).thenReturn(new Expectation[]{
                new ExpectationDTO().buildObject()
        });

        // when
        proxyClient
                .verify(
View Full Code Here

                    HttpRequestDTO httpRequestDTO = objectMapper.readValue(jsonHttpRequest, HttpRequestDTO.class);
                    if (httpRequestDTO != null) {
                        httpRequest = httpRequestDTO.buildObject();
                    }
                } else {
                    ExpectationDTO expectationDTO = objectMapper.readValue(jsonHttpRequest, ExpectationDTO.class);
                    if (expectationDTO != null) {
                        httpRequest = expectationDTO.buildObject().getHttpRequest();
                    }
                }
            } catch (IOException ioe) {
                logger.info("Exception while parsing response [" + jsonHttpRequest + "] for http response httpRequest", ioe);
            }
View Full Code Here

    public String serialize(Expectation expectation) {
        try {
            return objectMapper
                    .writerWithDefaultPrettyPrinter()
                    .writeValueAsString(new ExpectationDTO(expectation));
        } catch (IOException ioe) {
            logger.error(String.format("Exception while serializing expectation to JSON with value %s", expectation), ioe);
            throw new RuntimeException(String.format("Exception while serializing expectation to JSON with value %s", expectation), ioe);
        }
    }
View Full Code Here

TOP

Related Classes of org.mockserver.client.serialization.model.ExpectationDTO

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.