Search in sources :

Example 1 with ParameterTypeValidator

use of io.vertx.ext.web.api.validation.ParameterTypeValidator in project vertx-web by vert-x3.

the class SingleValueParameterTypeValidatorTest method nullTest.

@Test(expected = ValidationException.class)
public void nullTest() {
    ParameterTypeValidator validator = new MockSingleValueParameterTypeValidator(null);
    validator.isValid(null);
}
Also used : ParameterTypeValidator(io.vertx.ext.web.api.validation.ParameterTypeValidator) Test(org.junit.Test)

Example 2 with ParameterTypeValidator

use of io.vertx.ext.web.api.validation.ParameterTypeValidator in project vertx-web by vert-x3.

the class StringTypeValidatorTest method isValidMaxLength.

@Test
public void isValidMaxLength() {
    ParameterTypeValidator validator = new StringTypeValidator(null, null, 3, null);
    validator.isValid("aaa");
}
Also used : ParameterTypeValidator(io.vertx.ext.web.api.validation.ParameterTypeValidator) Test(org.junit.Test)

Example 3 with ParameterTypeValidator

use of io.vertx.ext.web.api.validation.ParameterTypeValidator in project vertx-web by vert-x3.

the class StringTypeValidatorTest method isValidPattern.

@Test
public void isValidPattern() {
    ParameterTypeValidator validator = new StringTypeValidator(RegularExpressions.EMAIL);
    validator.isValid("admin@vertx.io");
}
Also used : ParameterTypeValidator(io.vertx.ext.web.api.validation.ParameterTypeValidator) Test(org.junit.Test)

Example 4 with ParameterTypeValidator

use of io.vertx.ext.web.api.validation.ParameterTypeValidator in project vertx-web by vert-x3.

the class StringTypeValidatorTest method isNotValidPattern.

@Test(expected = ValidationException.class)
public void isNotValidPattern() {
    ParameterTypeValidator validator = new StringTypeValidator(RegularExpressions.EMAIL);
    validator.isValid("admin.vertx.io");
}
Also used : ParameterTypeValidator(io.vertx.ext.web.api.validation.ParameterTypeValidator) Test(org.junit.Test)

Example 5 with ParameterTypeValidator

use of io.vertx.ext.web.api.validation.ParameterTypeValidator in project vertx-web by vert-x3.

the class StringTypeValidatorTest method isValidMinLength.

@Test
public void isValidMinLength() {
    ParameterTypeValidator validator = new StringTypeValidator(null, 2, null, null);
    validator.isValid("aaa");
}
Also used : ParameterTypeValidator(io.vertx.ext.web.api.validation.ParameterTypeValidator) Test(org.junit.Test)

Aggregations

ParameterTypeValidator (io.vertx.ext.web.api.validation.ParameterTypeValidator)9 Test (org.junit.Test)8 AbstractVerticle (io.vertx.core.AbstractVerticle)1 HttpServerOptions (io.vertx.core.http.HttpServerOptions)1 JsonObject (io.vertx.core.json.JsonObject)1 Runner (io.vertx.example.util.Runner)1 Router (io.vertx.ext.web.Router)1 RequestParameter (io.vertx.ext.web.api.RequestParameter)1 RequestParameters (io.vertx.ext.web.api.RequestParameters)1 HTTPRequestValidationHandler (io.vertx.ext.web.api.validation.HTTPRequestValidationHandler)1 ParameterType (io.vertx.ext.web.api.validation.ParameterType)1 ValidationException (io.vertx.ext.web.api.validation.ValidationException)1 BodyHandler (io.vertx.ext.web.handler.BodyHandler)1