Package org.mockserver.client.serialization.model

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


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

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


        // 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)))
                .buildObject(), expectation);
    }
View Full Code Here

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

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

    @Test
    public void shouldSerializeCompleteObject() throws IOException {
        // when
        String jsonExpectation = new VerificationSerializer().serialize(
                new VerificationDTO()
                        .setHttpRequest(new HttpRequestDTO(request().withMethod("GET").withPath("somepath")))
                        .setTimes(new VerificationTimesDTO(VerificationTimes.exactly(2)))
                        .buildObject()
        );
View Full Code Here

    @Test
    public void shouldSerializePartialObject() throws IOException {
        // when
        String jsonExpectation = new VerificationSerializer().serialize(
                new VerificationDTO()
                        .setHttpRequest(new HttpRequestDTO(request()))
                        .buildObject()
        );

        // then
View Full Code Here

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

    public Verification deserialize(String jsonVerification) {
        Verification verification = null;
        if (jsonVerification != null && !jsonVerification.isEmpty()) {
            try {
                VerificationDTO verificationDTO = objectMapper.readValue(jsonVerification, VerificationDTO.class);
                if (verificationDTO != null) {
                    verification = verificationDTO.buildObject();
                }
            } catch (IOException ioe) {
                logger.info("Exception while parsing response [" + jsonVerification + "] for verification", ioe);
            }
        }
View Full Code Here

TOP

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

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.