Search in sources :

Example 1 with RegexBody

use of org.mockserver.model.RegexBody in project mockserver by mock-server.

the class RegexBodyDTOTest method shouldBuildCorrectObject.

@Test
public void shouldBuildCorrectObject() {
    // when
    RegexBody regexBody = new RegexBodyDTO(new RegexBody("some_body")).buildObject();
    // then
    assertThat(regexBody.getValue(), is("some_body"));
    assertThat(regexBody.getType(), is(Body.Type.REGEX));
}
Also used : RegexBody(org.mockserver.model.RegexBody) Test(org.junit.Test)

Example 2 with RegexBody

use of org.mockserver.model.RegexBody in project mockserver by mock-server.

the class RegexBodyDTOTest method shouldHandleEmptyByteArray.

@Test
public void shouldHandleEmptyByteArray() {
    // given
    String body = "";
    // when
    RegexBody regexBody = new RegexBodyDTO(new RegexBody(body)).buildObject();
    // then
    assertThat(regexBody.getValue(), is(""));
    assertThat(regexBody.getType(), is(Body.Type.REGEX));
}
Also used : RegexBody(org.mockserver.model.RegexBody) Test(org.junit.Test)

Example 3 with RegexBody

use of org.mockserver.model.RegexBody in project mockserver by mock-server.

the class RegexBodyDTOTest method shouldBuildCorrectObjectWithOptional.

@Test
public void shouldBuildCorrectObjectWithOptional() {
    // when
    RegexBody regexBody = new RegexBodyDTO((RegexBody) new RegexBody("some_body").withOptional(true)).buildObject();
    // then
    assertThat(regexBody.getValue(), is("some_body"));
    assertThat(regexBody.getType(), is(Body.Type.REGEX));
    assertThat(regexBody.getOptional(), is(true));
}
Also used : RegexBody(org.mockserver.model.RegexBody) Test(org.junit.Test)

Example 4 with RegexBody

use of org.mockserver.model.RegexBody in project mockserver by mock-server.

the class RegexBodyDTOTest method shouldReturnValuesSetInConstructor.

@Test
public void shouldReturnValuesSetInConstructor() {
    // when
    RegexBodyDTO regexBody = new RegexBodyDTO(new RegexBody("some_body"));
    // then
    assertThat(regexBody.getRegex(), is("some_body"));
    assertThat(regexBody.getType(), is(Body.Type.REGEX));
}
Also used : RegexBody(org.mockserver.model.RegexBody) Test(org.junit.Test)

Example 5 with RegexBody

use of org.mockserver.model.RegexBody in project mockserver by mock-server.

the class RegexBodyDTOTest method shouldHandleNull.

@Test
public void shouldHandleNull() {
    // given
    String body = null;
    // when
    RegexBody regexBody = new RegexBodyDTO(new RegexBody(body)).buildObject();
    // then
    assertThat(regexBody.getValue(), nullValue());
    assertThat(regexBody.getType(), is(Body.Type.REGEX));
}
Also used : RegexBody(org.mockserver.model.RegexBody) Test(org.junit.Test)

Aggregations

RegexBody (org.mockserver.model.RegexBody)6 Test (org.junit.Test)5 FullTrigger (com.redhat.cloud.policies.app.model.engine.FullTrigger)1 Trigger (com.redhat.cloud.policies.app.model.engine.Trigger)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HashMap (java.util.HashMap)1 JsonBody (org.mockserver.model.JsonBody)1