Search in sources :

Example 1 with LengthValidator

use of com.thinkbiganalytics.policy.validation.LengthValidator in project kylo by Teradata.

the class TestValidationTransformation method testLengthValidator.

@Test
public void testLengthValidator() {
    Integer min = 10;
    Integer max = 20;
    LengthValidator validator = new LengthValidator(min, max);
    FieldValidationRule uiModel = ValidatorAnnotationTransformer.instance().toUIModel(validator);
    LengthValidator convertedValidator = fromUI(uiModel, LengthValidator.class);
    Assert.assertEquals(min.intValue(), convertedValidator.getMinLength());
    Assert.assertEquals(max.intValue(), convertedValidator.getMaxLength());
}
Also used : LengthValidator(com.thinkbiganalytics.policy.validation.LengthValidator) FieldValidationRule(com.thinkbiganalytics.policy.rest.model.FieldValidationRule) Test(org.junit.Test)

Aggregations

FieldValidationRule (com.thinkbiganalytics.policy.rest.model.FieldValidationRule)1 LengthValidator (com.thinkbiganalytics.policy.validation.LengthValidator)1 Test (org.junit.Test)1