use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MaxValueValidatorTest method testNoFailure.
/**
* If the one rule is satisfied, there should be no validation exception.
*/
@Test
public void testNoFailure() throws ApplicationException, FrameworkException {
TestModel testModel = new TestModel();
// max value not exceeded
testModel.setField2(7);
targetMaxValue.validate(testModel);
}
use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MaxValueValidatorTest method testValidator.
/**
* If the field value is to large, the validator should throw a exceeds max exception with the field label.
*/
@Test
public void testValidator() throws ApplicationException, FrameworkException {
TestModel testModel = new TestModel();
// max value is exceeded
testModel.setField2(13);
executeValidator(targetMaxValue, testModel, "[Field2]", ExceedsMaximumException.class);
}
use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MaxValueValidatorTest method testInterceptor.
/**
* Demonstrate that there's a proper situation for the MaxValueInterceptor to throw.
*/
@Test
public void testInterceptor() throws Throwable {
TestModel testModel = new TestModel();
// max value is exceeded
testModel.setField2(13);
executeInterceptor(MaxValueInterceptor.class, testModel, "[Field2]", ExceedsMaximumException.class);
}
use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MinLengthValidatorTest method testValidator.
/**
* If the field length is to short, the validator should throw a too much data field exception with the field label.
*/
@Test
public void testValidator() throws ApplicationException, FrameworkException {
TestModel testModel = new TestModel();
// min length is exceeded
testModel.setField1("1");
executeValidator(targetMinLength, testModel, "[Field1]", TooLittleDataException.class);
}
use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MinLengthValidatorTest method testNoFailure.
/**
* If the one rule is satisfied, there should be no validation exception.
*/
@Test
public void testNoFailure() throws ApplicationException, FrameworkException {
TestModel testModel = new TestModel();
// not below min length
testModel.setField1("123");
targetMinLength.validate(testModel);
}
Aggregations