use of cn.taketoday.aop.support.StaticMethodMatcherPointcut in project today-framework by TAKETODAY.
the class AopUtilsTests method testPointcutAppliesToOneMethodOnObject.
@Test
public void testPointcutAppliesToOneMethodOnObject() {
class TestPointcut extends StaticMethodMatcherPointcut {
@Override
public boolean matches(Method method, Class<?> clazz) {
return method.getName().equals("hashCode");
}
}
Pointcut pc = new TestPointcut();
// will return true if we're not proxying interfaces
assertThat(AopUtils.canApply(pc, Object.class)).isTrue();
}
use of cn.taketoday.aop.support.StaticMethodMatcherPointcut in project today-framework by TAKETODAY.
the class AopUtilsTests method testPointcutCanNeverApply.
@Test
public void testPointcutCanNeverApply() {
class TestPointcut extends StaticMethodMatcherPointcut {
@Override
public boolean matches(Method method, Class<?> clazzy) {
return false;
}
}
Pointcut no = new TestPointcut();
assertThat(AopUtils.canApply(no, Object.class)).isFalse();
}
Aggregations