use of org.jaffa.rules.jbossaop.interceptors.CaseTypeInterceptor in project jaffa-framework by jaffa-projects.
the class CaseTypeValidatorTest method testInterceptor.
/**
* Demonstrate that there's a proper situation for the CaseTypeInterceptor to change the case of the field.
*/
@Test
public void testInterceptor() throws Throwable {
testModel.setField1(TEST_STRING);
CaseTypeInterceptor interceptor = new CaseTypeInterceptor();
interceptor.setTargetClassName(TestModel.class.getName());
Method method = TestModel.class.getMethod("validate");
MethodInvocation invocation = new MethodInvocation(new Interceptor[0], 0, method, method, null);
// "field1" is configured to be UPPER CASE, but is set to all lower case.
invocation.setTargetObject(testModel);
interceptor.invoke(invocation);
assertEquals(TEST_STRING.toUpperCase(), testModel.getField1());
}
Aggregations