use of org.mockserver.serialization.model.VerificationSequenceDTO in project mockserver by mock-server.
the class VerificationSequenceSerializerIntegrationTest method shouldDeserializePartialObject.
@Test
public void shouldDeserializePartialObject() {
// given
String requestBytes = "{" + NEW_LINE + " \"httpRequests\" : [ {" + NEW_LINE + " \"path\" : \"some_path_one\"" + NEW_LINE + " } ]" + NEW_LINE + "}";
// when
VerificationSequence verificationSequence = new VerificationSequenceSerializer(new MockServerLogger()).deserialize(requestBytes);
// then
assertEquals(new VerificationSequenceDTO().setHttpRequests(Collections.singletonList(new HttpRequestDTO(request("some_path_one")))).buildObject(), verificationSequence);
}
use of org.mockserver.serialization.model.VerificationSequenceDTO in project mockserver by mock-server.
the class VerificationSequenceSerializerIntegrationTest method shouldSerializeEmptyObject.
@Test
public void shouldSerializeEmptyObject() {
// when
String jsonExpectation = new VerificationSequenceSerializer(new MockServerLogger()).serialize(new VerificationSequenceDTO().setHttpRequests(Collections.emptyList()).buildObject());
// then
assertEquals("{ }", jsonExpectation);
}
use of org.mockserver.serialization.model.VerificationSequenceDTO in project mockserver by mock-server.
the class VerificationSequenceSerializerIntegrationTest method shouldDeserializeEmptyObject.
@Test
public void shouldDeserializeEmptyObject() {
// given
String requestBytes = "{" + NEW_LINE + " \"httpRequests\" : [ ]" + NEW_LINE + "}";
// when
VerificationSequence verificationSequence = new VerificationSequenceSerializer(new MockServerLogger()).deserialize(requestBytes);
// then
assertEquals(new VerificationSequenceDTO().setHttpRequests(Collections.emptyList()).buildObject(), verificationSequence);
}
use of org.mockserver.serialization.model.VerificationSequenceDTO in project mockserver by mock-server.
the class VerificationSequenceSerializerIntegrationTest method shouldSerializePartialObject.
@Test
public void shouldSerializePartialObject() {
// when
String jsonExpectation = new VerificationSequenceSerializer(new MockServerLogger()).serialize(new VerificationSequenceDTO().setHttpRequests(Collections.singletonList(new HttpRequestDTO(request("some_path_one").withBody("some_body_one")))).buildObject());
// then
assertEquals("{" + NEW_LINE + " \"httpRequests\" : [ {" + NEW_LINE + " \"path\" : \"some_path_one\"," + NEW_LINE + " \"body\" : \"some_body_one\"" + NEW_LINE + " } ]" + NEW_LINE + "}", jsonExpectation);
}
use of org.mockserver.serialization.model.VerificationSequenceDTO in project mockserver by mock-server.
the class VerificationSequenceSerializerIntegrationTest method shouldDeserializeCompleteObjectWithExpectationIds.
@Test
public void shouldDeserializeCompleteObjectWithExpectationIds() {
// given
String requestBytes = "{" + NEW_LINE + " \"expectationIds\" : [ {" + NEW_LINE + " \"id\" : \"one\"" + NEW_LINE + " }, {" + NEW_LINE + " \"id\" : \"two\"" + NEW_LINE + " } ]" + NEW_LINE + "}";
// when
VerificationSequence verificationSequence = new VerificationSequenceSerializer(new MockServerLogger()).deserialize(requestBytes);
// then
assertEquals(new VerificationSequenceDTO().setExpectationIds(Arrays.asList(new ExpectationId().withId("one"), new ExpectationId().withId("two"))).buildObject(), verificationSequence);
}
Aggregations