assertEquals("test", object.aMethod());
}
@Test
public void interceptsReflectionMethodCalls() throws Exception {
ClassWithMethods object = (ClassWithMethods) ProxyCreator.create(ClassWithMethods.class,
new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return "test";
}
});
Method method = object.getClass().getMethod("aMethod");
assertEquals("test", method.invoke(object));
}