use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MaxLengthValidatorTest method testInterceptor.
/**
* Demonstrate that there's a proper situation for the MaxLengthInterceptor to throw.
*/
@Test
public void testInterceptor() throws Throwable {
TestModel testModel = new TestModel();
// max length is exceeded
testModel.setField1("1234567891011");
executeInterceptor(MaxLengthInterceptor.class, testModel, "[Field1]", TooMuchDataException.class);
}
use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MinLengthValidatorTest method testInterceptor.
/**
* Demonstrate that there's a proper situation for the MaxLengthInterceptor to throw.
*/
@Test
public void testInterceptor() throws Throwable {
TestModel testModel = new TestModel();
// min length is exceeded
testModel.setField1("1");
executeInterceptor(MinLengthInterceptor.class, testModel, "[Field1]", TooLittleDataException.class);
}
use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MinValueValidatorTest method testValidator.
/**
* If the field value is to small, the validator should throw a below min exception with the field label.
*/
@Test
public void testValidator() throws ApplicationException, FrameworkException {
TestModel testModel = new TestModel();
// min value is exceeded
testModel.setField2(1);
executeValidator(targetMinValue, testModel, "[Field2]", BelowMinimumException.class);
}
use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class MinValueValidatorTest method testInterceptor.
/**
* Demonstrate that there's a proper situation for the MaxValueInterceptor to throw.
*/
@Test
public void testInterceptor() throws Throwable {
TestModel testModel = new TestModel();
// min value is exceeded
testModel.setField2(1);
executeInterceptor(MinValueInterceptor.class, testModel, "[Field2]", BelowMinimumException.class);
}
use of org.jaffa.rules.TestModel in project jaffa-framework by jaffa-projects.
the class FieldInitializerTest method testInitializer.
/**
* Tests the initializer rule sets the property value
*/
@Test
public void testInitializer() throws FrameworkException {
TestModel testModel = new TestModel();
assertNull(testModel.getField1());
target.initialize(testModel);
// test when member parameter is not provided
assertEquals(FIELD1_INIT_VALUE, testModel.getField1());
// test when member parameter is provided
assertEquals(FIELD2_INIT_VALUE, testModel.getField2());
}
Aggregations