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));
}
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));
}
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));
}
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));
}
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));
}
Aggregations