Package org.mockserver.model

Examples of org.mockserver.model.HttpResponse


        assertTrue(new HttpResponseMatcher(new HttpResponse().withStatusCode(202)).matches(new HttpResponse().withStatusCode(202)));
    }

    @Test
    public void doesNotMatchIncorrectStatusCode() {
        assertFalse(new HttpResponseMatcher(new HttpResponse().withStatusCode(202)).matches(new HttpResponse().withStatusCode(500)));
    }
View Full Code Here


        assertFalse(new HttpResponseMatcher(new HttpResponse().withStatusCode(202)).matches(new HttpResponse().withStatusCode(500)));
    }

    @Test
    public void matchesMatchingBody() {
        assertTrue(new HttpResponseMatcher(new HttpResponse().withBody(new StringBody("somebody", Type.STRING))).matches(new HttpResponse().withBody("somebody")));
    }
View Full Code Here

        assertTrue(new HttpResponseMatcher(new HttpResponse().withBody(new StringBody("somebody", Type.STRING))).matches(new HttpResponse().withBody("somebody")));
    }

    @Test
    public void doesNotMatchIncorrectBody() {
        assertFalse(new HttpResponseMatcher(new HttpResponse().withBody(exact("somebody"))).matches(new HttpResponse().withBody("bodysome")));
    }
View Full Code Here

        assertFalse(new HttpResponseMatcher(new HttpResponse().withBody(exact("somebody"))).matches(new HttpResponse().withBody("bodysome")));
    }

    @Test
    public void matchesMatchingBodyRegex() {
        assertTrue(new HttpResponseMatcher(new HttpResponse().withBody(regex("some[a-z]{4}"))).matches(new HttpResponse().withBody("somebody")));
    }
View Full Code Here

        assertTrue(new HttpResponseMatcher(new HttpResponse().withBody(regex("some[a-z]{4}"))).matches(new HttpResponse().withBody("somebody")));
    }

    @Test
    public void doesNotMatchIncorrectBodyRegex() {
        assertFalse(new HttpResponseMatcher(new HttpResponse().withBody(regex("some[a-z]{3}"))).matches(new HttpResponse().withBody("bodysome")));
    }
View Full Code Here

        String matched = "" +
                "<element>" +
                "   <key>some_key</key>" +
                "   <value>some_value</value>" +
                "</element>";
        assertTrue(new HttpResponseMatcher(new HttpResponse().withBody(xpath("/element[key = 'some_key' and value = 'some_value']"))).matches(new HttpResponse().withBody(matched)));
    }
View Full Code Here

    public void doesNotMatchIncorrectBodyXPath() {
        String matched = "" +
                "<element>" +
                "   <key>some_key</key>" +
                "</element>";
        assertFalse(new HttpResponseMatcher(new HttpResponse().withBody(xpath("/element[key = 'some_key' and value = 'some_value']"))).matches(new HttpResponse().withBody(matched)));
    }
View Full Code Here

        String matched = "" +
                "{ " +
                "   \"some_field\": \"some_value\", " +
                "   \"some_other_field\": \"some_other_value\" " +
                "}";
        assertTrue(new HttpResponseMatcher(new HttpResponse().withBody(json("{ \"some_field\": \"some_value\" }"))).matches(new HttpResponse().withBody(matched)));
    }
View Full Code Here

        String matched = "" +
                "{ " +
                "   \"some_incorrect_field\": \"some_value\", " +
                "   \"some_other_field\": \"some_other_value\" " +
                "}";
        assertFalse(new HttpResponseMatcher(new HttpResponse().withBody(json("{ \"some_field\": \"some_value\" }"))).matches(new HttpResponse().withBody(matched)));
    }
View Full Code Here


    @Test
    public void matchesMatchingBinaryBody() {
        byte[] matched = "some binary value".getBytes();
        assertTrue(new HttpResponseMatcher(new HttpResponse().withBody(binary("some binary value".getBytes()))).matches(new HttpResponse().withBody(matched)));
    }
View Full Code Here

TOP

Related Classes of org.mockserver.model.HttpResponse

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.