Search in sources :

Example 1 with VerificationSequenceDTO

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);
}
Also used : MockServerLogger(org.mockserver.logging.MockServerLogger) VerificationSequence(org.mockserver.verify.VerificationSequence) HttpRequestDTO(org.mockserver.serialization.model.HttpRequestDTO) VerificationSequenceDTO(org.mockserver.serialization.model.VerificationSequenceDTO) Test(org.junit.Test)

Example 2 with VerificationSequenceDTO

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);
}
Also used : MockServerLogger(org.mockserver.logging.MockServerLogger) VerificationSequenceDTO(org.mockserver.serialization.model.VerificationSequenceDTO) Test(org.junit.Test)

Example 3 with VerificationSequenceDTO

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);
}
Also used : MockServerLogger(org.mockserver.logging.MockServerLogger) VerificationSequence(org.mockserver.verify.VerificationSequence) VerificationSequenceDTO(org.mockserver.serialization.model.VerificationSequenceDTO) Test(org.junit.Test)

Example 4 with VerificationSequenceDTO

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);
}
Also used : MockServerLogger(org.mockserver.logging.MockServerLogger) HttpRequestDTO(org.mockserver.serialization.model.HttpRequestDTO) VerificationSequenceDTO(org.mockserver.serialization.model.VerificationSequenceDTO) Test(org.junit.Test)

Example 5 with VerificationSequenceDTO

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);
}
Also used : ExpectationId(org.mockserver.model.ExpectationId) MockServerLogger(org.mockserver.logging.MockServerLogger) VerificationSequence(org.mockserver.verify.VerificationSequence) VerificationSequenceDTO(org.mockserver.serialization.model.VerificationSequenceDTO) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 MockServerLogger (org.mockserver.logging.MockServerLogger)7 VerificationSequenceDTO (org.mockserver.serialization.model.VerificationSequenceDTO)7 HttpRequestDTO (org.mockserver.serialization.model.HttpRequestDTO)4 VerificationSequence (org.mockserver.verify.VerificationSequence)4 ExpectationId (org.mockserver.model.ExpectationId)1