use of org.mockserver.serialization.model.VerificationDTO in project mockserver by mock-server.
the class VerificationSerializerIntegrationTest method shouldSerializeCompleteObject.
@Test
public void shouldSerializeCompleteObject() {
// when
String jsonExpectation = new VerificationSerializer(new MockServerLogger()).serialize(new VerificationDTO().setHttpRequest(new HttpRequestDTO(request().withMethod("GET").withPath("somepath"))).setTimes(new VerificationTimesDTO(VerificationTimes.between(2, 3))).buildObject());
// then
assertEquals("{" + NEW_LINE + " \"httpRequest\" : {" + NEW_LINE + " \"method\" : \"GET\"," + NEW_LINE + " \"path\" : \"somepath\"" + NEW_LINE + " }," + NEW_LINE + " \"times\" : {" + NEW_LINE + " \"atLeast\" : 2," + NEW_LINE + " \"atMost\" : 3" + NEW_LINE + " }" + NEW_LINE + "}", jsonExpectation);
}
use of org.mockserver.serialization.model.VerificationDTO in project mockserver by mock-server.
the class VerificationSerializerIntegrationTest method shouldDeserializePartialObject.
@Test
public void shouldDeserializePartialObject() {
// given
String requestBytes = "{" + NEW_LINE + " \"httpRequest\" : {" + NEW_LINE + " }" + NEW_LINE + "}";
// when
Verification verification = new VerificationSerializer(new MockServerLogger()).deserialize(requestBytes);
// then
assertEquals(new VerificationDTO().setHttpRequest(new HttpRequestDTO(request())).buildObject(), verification);
}
use of org.mockserver.serialization.model.VerificationDTO in project mockserver by mock-server.
the class VerificationSerializerIntegrationTest method shouldDeserializeCompleteObject.
@Test
public void shouldDeserializeCompleteObject() {
// given
String requestBytes = "{" + NEW_LINE + " \"httpRequest\" : {" + NEW_LINE + " \"method\" : \"GET\"," + NEW_LINE + " \"path\" : \"somepath\"" + NEW_LINE + " }," + NEW_LINE + " \"times\" : {" + NEW_LINE + " \"atLeast\" : 2," + NEW_LINE + " \"atMost\" : 3" + NEW_LINE + " }" + NEW_LINE + "}";
// when
Verification verification = new VerificationSerializer(new MockServerLogger()).deserialize(requestBytes);
// then
assertEquals(new VerificationDTO().setHttpRequest(new HttpRequestDTO(request().withMethod("GET").withPath("somepath"))).setTimes(new VerificationTimesDTO(VerificationTimes.between(2, 3))).buildObject(), verification);
}
use of org.mockserver.serialization.model.VerificationDTO in project mockserver by mock-server.
the class VerificationSerializerIntegrationTest method shouldSerializePartialObject.
@Test
public void shouldSerializePartialObject() {
// when
String jsonExpectation = new VerificationSerializer(new MockServerLogger()).serialize(new VerificationDTO().setHttpRequest(new HttpRequestDTO(request())).buildObject());
// then
assertEquals("{" + NEW_LINE + " \"httpRequest\" : { }," + NEW_LINE + " \"times\" : {" + NEW_LINE + " \"atLeast\" : 1," + NEW_LINE + " \"atMost\" : 1" + NEW_LINE + " }" + NEW_LINE + "}", jsonExpectation);
}
Aggregations