Package org.mockserver.verify

Examples of org.mockserver.verify.Verification


        }
        if (times == null) {
            throw new IllegalArgumentException("verify(HttpRequest, VerificationTimes) requires a non null VerificationTimes object");
        }

        Verification verification = new Verification().withRequest(httpRequest).withTimes(times);
        String result = apacheHttpClient.sendPUTRequest(uriBase, "/verify", verificationSerializer.serialize(verification));

        if (result != null && !result.isEmpty()) {
            throw new AssertionError("Request not found " + times + " " + result);
        }
View Full Code Here


            mockServerClient.verify(httpRequest);

            // then
            fail();
        } catch (AssertionError ae) {
            verify(verificationSerializer).serialize(new Verification().withRequest(httpRequest).withTimes(atLeast(1)));
            assertThat(ae.getMessage(), is("Request not found at least once expected:<foo> but was:<bar>"));
        }
    }
View Full Code Here

            mockServerClient.verify(httpRequest, httpRequest);

            // then
            fail();
        } catch (AssertionError ae) {
            verify(verificationSerializer).serialize(new Verification().withRequest(httpRequest).withTimes(atLeast(1)));
            assertThat(ae.getMessage(), is("Request not found at least once expected:<foo> but was:<bar>"));
        }
    }
View Full Code Here

        } catch (AssertionError ae) {
            fail();
        }

        // then
        verify(verificationSerializer).serialize(new Verification().withRequest(httpRequest).withTimes(atLeast(1)));
    }
View Full Code Here

        } catch (AssertionError ae) {
            fail();
        }

        // then
        verify(verificationSerializer).serialize(new Verification().withRequest(httpRequest).withTimes(once()));
    }
View Full Code Here

            mockServerClient.verify(httpRequest, atLeast(1));

            // then
            fail();
        } catch (AssertionError ae) {
            verify(verificationSerializer).serialize(new Verification().withRequest(httpRequest).withTimes(atLeast(1)));
            assertThat(ae.getMessage(), is("Request not found at least once expected:<foo> but was:<bar>"));
        }
    }
View Full Code Here

            mockServerClient.verify(httpRequest, once());

            // then
            fail();
        } catch (AssertionError ae) {
            verify(verificationSerializer).serialize(new Verification().withRequest(httpRequest).withTimes(once()));
            assertThat(ae.getMessage(), is("Request not found exactly once expected:<foo> but was:<bar>"));
        }
    }
View Full Code Here

            mockServerClient.verify(httpRequest, atLeast(2));

            // then
            fail();
        } catch (AssertionError ae) {
            verify(verificationSerializer).serialize(new Verification().withRequest(httpRequest).withTimes(atLeast(2)));
            assertThat(ae.getMessage(), is("Request not found at least 2 times expected:<foo> but was:<bar>"));
        }
    }
View Full Code Here

            mockServerClient.verify(httpRequest, exactly(2));

            // then
            fail();
        } catch (AssertionError ae) {
            verify(verificationSerializer).serialize(new Verification().withRequest(httpRequest).withTimes(exactly(2)));
            assertThat(ae.getMessage(), is("Request not found exactly 2 times expected:<foo> but was:<bar>"));
        }
    }
View Full Code Here

    @Test
    public void shouldVerifyRequestNotMatching() 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("verification_error");
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.