use of cn.taketoday.aop.framework.JdkDynamicAopProxy in project today-framework by TAKETODAY.
the class JdkDynamicAopProxyTests method testProxyIsJustInterface.
@Test
public void testProxyIsJustInterface() {
TestBean raw = new TestBean();
raw.setAge(32);
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
pc.setTarget(raw);
JdkDynamicAopProxy aop = new JdkDynamicAopProxy(pc);
Object proxy = aop.getProxy();
boolean condition = proxy instanceof ITestBean;
assertThat(condition).isTrue();
boolean condition1 = proxy instanceof TestBean;
assertThat(condition1).isFalse();
}
use of cn.taketoday.aop.framework.JdkDynamicAopProxy in project today-framework by TAKETODAY.
the class JdkDynamicAopProxyTests method testEqualsAndHashCodeDefined.
@Test
public void testEqualsAndHashCodeDefined() {
AdvisedSupport as = new AdvisedSupport(Named.class);
as.setTarget(new Person());
JdkDynamicAopProxy aopProxy = new JdkDynamicAopProxy(as);
Named proxy = (Named) aopProxy.getProxy();
Named named = new Person();
assertThat(proxy).isEqualTo(named);
assertThat(named.hashCode()).isEqualTo(proxy.hashCode());
}
Aggregations