use of org.jaffa.rules.jbossaop.interceptors.CommentInterceptor in project jaffa-framework by jaffa-projects.
the class CommentValidatorTest method testInterceptor.
/**
* Demonstrate that there's a proper situation for the CommentInterceptor to change the value of the field.
*/
@Test
public void testInterceptor() throws Throwable {
testModel.setField1(NEW_COMMENT);
testModel.setOriginalValue("");
CommentInterceptor interceptor = new CommentInterceptor();
interceptor.setTargetClassName(TestModel.class.getName());
Method method = TestModel.class.getMethod("validate");
MethodInvocation invocation = new MethodInvocation(new Interceptor[0], 0, method, method, null);
// "field3" is configured for the comment
invocation.setTargetObject(testModel);
interceptor.invoke(invocation);
// if field1 has changed, them the comment was changed by the interceptor.
assertNotEquals(NEW_COMMENT, testModel.getField1());
}
Aggregations