Package org.mockserver.verify

Examples of org.mockserver.verify.Verification


    @Test
    public void shouldVerifyRequestMatching() throws IOException {
        // given
        MockHttpServletResponse httpServletResponse = new MockHttpServletResponse();
        MockHttpServletRequest httpServletRequest = new MockHttpServletRequest("PUT", "/verify");
        Verification verification = new Verification().withRequest(new HttpRequest()).withTimes(VerificationTimes.once());

        String requestBytes = "requestBytes";
        httpServletRequest.setContent(requestBytes.getBytes());
        when(mockVerificationSerializer.deserialize(requestBytes)).thenReturn(verification);
        when(mockLogFilter.verify(verification)).thenReturn("");
View Full Code Here


    @Test
    public void shouldReturnValueSetInSetter() {
        // when
        HttpRequest request = request();
        VerificationTimes times = atLeast(2);
        Verification verification = new Verification()
                .withRequest(request)
                .withTimes(times);

        // then
        assertThat(verification.getHttpRequest(), sameInstance(request));
        assertThat(verification.getTimes(), sameInstance(times));
    }
View Full Code Here

    @Test
    public void shouldReturnValueSetInConstructor() {
        // given
        HttpRequest request = request();
        VerificationTimes times = VerificationTimes.atLeast(1);
        Verification verification = new Verification()
                .withRequest(request)
                .withTimes(times);

        // when
        VerificationDTO verificationDTO = new VerificationDTO(verification);
View Full Code Here

    @Test
    public void shouldBuildObject() {
        // given
        HttpRequest request = request();
        VerificationTimes times = VerificationTimes.atLeast(1);
        Verification verification = new Verification()
                .withRequest(request)
                .withTimes(times);

        // when
        Verification builtVerification = new VerificationDTO(verification).buildObject();

        // then
        assertThat(builtVerification.getHttpRequest(), is(request));
        assertThat(builtVerification.getTimes(), is(times));
    }
View Full Code Here

    @Test
    public void shouldReturnValueSetInSetter() {
        // given
        HttpRequestDTO request = new HttpRequestDTO(request());
        VerificationTimesDTO times = new VerificationTimesDTO(VerificationTimes.atLeast(1));
        Verification verification = new Verification();

        // when
        VerificationDTO verificationDTO = new VerificationDTO(verification);
        verificationDTO.setHttpRequest(request);
        verificationDTO.setTimes(times);
View Full Code Here

    }

    @Test
    public void shouldHandleNullFieldInput() {
        // when
        VerificationDTO verificationDTO = new VerificationDTO(new Verification());

        // then
        assertThat(verificationDTO.getHttpRequest(), is(new HttpRequestDTO(request())));
        assertThat(verificationDTO.getTimes(), is(new VerificationTimesDTO(VerificationTimes.once())));
    }
View Full Code Here

                "    \"path\" : \"somepath\"" + System.getProperty("line.separator") +
                "  }" + System.getProperty("line.separator") +
                "}";

        // when
        Verification expectation = new VerificationSerializer().deserialize(requestBytes);

        // then
        assertEquals(new VerificationDTO()
                .setHttpRequest(new HttpRequestDTO(request().withPath("somepath")))
                .buildObject(), expectation);
View Full Code Here

                "    \"exact\" : true" + System.getProperty("line.separator") +
                "  }" + System.getProperty("line.separator") +
                "}";

        // when
        Verification expectation = new VerificationSerializer().deserialize(requestBytes);

        // then
        assertEquals(new VerificationDTO()
                .setHttpRequest(new HttpRequestDTO(request().withMethod("GET").withPath("somepath")))
                .setTimes(new VerificationTimesDTO(VerificationTimes.exactly(2)))
View Full Code Here

        String requestBytes = "{" + System.getProperty("line.separator") +
                "    \"path\": \"somePath\"" + System.getProperty("line.separator") +
                "}";

        // when
        Verification expectation = new VerificationSerializer().deserialize(requestBytes);

        // then
        assertEquals(new VerificationDTO()
                .setHttpRequest(new HttpRequestDTO(request()))
                .buildObject(), expectation);
View Full Code Here

    public void deserialize() throws IOException {
        // given
        when(objectMapper.readValue(eq("requestBytes"), same(VerificationDTO.class))).thenReturn(fullVerificationDTO);

        // when
        Verification verification = verificationSerializer.deserialize("requestBytes");

        // then
        assertEquals(fullVerification, verification);
    }
View Full Code Here

TOP

Related Classes of org.mockserver.verify.Verification

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.