Package org.mockserver.model

Examples of org.mockserver.model.StringBody


        assertThat(stringBody.getType(), is(Body.Type.XPATH));
    }

    @Test
    public void shouldReturnCorrectObjectFromStaticBuilder() {
        assertThat(exact("some_body"), is(new StringBody("some_body", Body.Type.STRING)));
        assertThat(regex("some_body"), is(new StringBody("some_body", Body.Type.REGEX)));
        assertThat(xpath("some_body"), is(new StringBody("some_body", Body.Type.XPATH)));
    }
View Full Code Here


public class StringBodyDTOTest {

    @Test
    public void shouldReturnValueSetInConstructor() {
        // when
        StringBodyDTO stringBody = new StringBodyDTO(new StringBody("some_body", Body.Type.STRING));

        // then
        assertThat(stringBody.getValue(), is("some_body"));
        assertThat(stringBody.getType(), is(Body.Type.STRING));
    }
View Full Code Here

    }

    @Test
    public void shouldBuildCorrectObject() {
        // when
        StringBody stringBody = new StringBodyDTO(new StringBody("some_body", Body.Type.XPATH)).buildObject();

        // then
        assertThat(stringBody.getValue(), is("some_body"));
        assertThat(stringBody.getType(), is(Body.Type.XPATH));
    }
View Full Code Here

        assertThat(stringBody.getType(), is(Body.Type.XPATH));
    }

    @Test
    public void shouldReturnCorrectObjectFromStaticBuilder() {
        assertThat(exact("some_body"), is(new StringBody("some_body", Body.Type.STRING)));
        assertThat(regex("some_body"), is(new StringBody("some_body", Body.Type.REGEX)));
        assertThat(xpath("some_body"), is(new StringBody("some_body", Body.Type.XPATH)));
    }
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

        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

        assertFalse(new HttpRequestMatcher(new HttpRequest().withBody(new ParameterBody(new Parameter("name", "va[0-9]{1}ue")))).matches(new HttpRequest().withBody(new ParameterBody(new Parameter("name", "value1")))));
    }

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

        assertEquals(new HttpRequestDTO()
                .setMethod("someMethod")
                .setURL("http://www.example.com")
                .setPath("somePath")
                .setQueryStringParameters(Arrays.<ParameterDTO>asList((ParameterDTO) new ParameterDTO(new Parameter("queryParameterName", Arrays.asList("queryParameterValue")))))
                .setBody(BodyDTO.createDTO(new StringBody("somebody", Body.Type.STRING)))
                .setHeaders(Arrays.<HeaderDTO>asList(new HeaderDTO(new Header("someHeaderName", Arrays.asList("someHeaderValue")))))
                .setCookies(Arrays.<CookieDTO>asList(new CookieDTO(new Cookie("someCookieName", Arrays.asList("someCookieValue")))))
                .buildObject(), expectation);
    }
View Full Code Here

                new HttpRequestDTO()
                        .setMethod("someMethod")
                        .setURL("http://www.example.com")
                        .setPath("somePath")
                        .setQueryStringParameters(Arrays.<ParameterDTO>asList((ParameterDTO) new ParameterDTO(new Parameter("queryParameterName", Arrays.asList("queryParameterValue")))))
                        .setBody(BodyDTO.createDTO(new StringBody("somebody", Body.Type.STRING)))
                        .setHeaders(Arrays.<HeaderDTO>asList(new HeaderDTO(new Header("someHeaderName", Arrays.asList("someHeaderValue")))))
                        .setCookies(Arrays.<CookieDTO>asList(new CookieDTO(new Cookie("someCookieName", Arrays.asList("someCookieValue")))))
                        .buildObject()
        );
View Full Code Here

    public String getValue() {
        return value;
    }

    public StringBody buildObject() {
        return new StringBody(value, getType());
    }
View Full Code Here

TOP

Related Classes of org.mockserver.model.StringBody

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.