use of cn.taketoday.aop.MethodBeforeAdvice in project today-framework by TAKETODAY.
the class AbstractAopProxyTests method testProxyConfigString.
/**
* Check that the string is informative.
*/
@Test
public void testProxyConfigString() {
TestBean target = new TestBean();
ProxyFactory pc = new ProxyFactory(target);
pc.setInterfaces(ITestBean.class);
pc.addAdvice(new NopInterceptor());
MethodBeforeAdvice mba = new CountingBeforeAdvice();
Advisor advisor = new DefaultPointcutAdvisor(new NameMatchMethodPointcut(), mba);
pc.addAdvisor(advisor);
ITestBean proxied = (ITestBean) createProxy(pc);
String proxyConfigString = ((Advised) proxied).toProxyConfigString();
assertThat(proxyConfigString.contains(advisor.toString())).isTrue();
assertThat(proxyConfigString.contains("1 interface")).isTrue();
}
Aggregations