Search in sources :

Example 1 with Person

use of org.springframework.test.util.subpackage.Person in project spring-framework by spring-projects.

the class ReflectionTestUtilsTests method setFieldAndGetFieldViaCglibProxy.

@Test
public void setFieldAndGetFieldViaCglibProxy() throws Exception {
    ProxyFactory pf = new ProxyFactory(this.person);
    pf.setProxyTargetClass(true);
    Person proxy = (Person) pf.getProxy();
    assertTrue("Proxy is a CGLIB proxy", AopUtils.isCglibProxy(proxy));
    assertSetFieldAndGetFieldBehaviorForProxy(proxy, this.person);
}
Also used : ProxyFactory(org.springframework.aop.framework.ProxyFactory) Person(org.springframework.test.util.subpackage.Person) Test(org.junit.Test)

Example 2 with Person

use of org.springframework.test.util.subpackage.Person in project spring-framework by spring-projects.

the class ReflectionTestUtilsTests method setFieldAndGetFieldViaJdkDynamicProxy.

@Test
public void setFieldAndGetFieldViaJdkDynamicProxy() throws Exception {
    ProxyFactory pf = new ProxyFactory(this.person);
    pf.addInterface(Person.class);
    Person proxy = (Person) pf.getProxy();
    assertTrue("Proxy is a JDK dynamic proxy", AopUtils.isJdkDynamicProxy(proxy));
    assertSetFieldAndGetFieldBehaviorForProxy(proxy, this.person);
}
Also used : ProxyFactory(org.springframework.aop.framework.ProxyFactory) Person(org.springframework.test.util.subpackage.Person) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ProxyFactory (org.springframework.aop.framework.ProxyFactory)2 Person (org.springframework.test.util.subpackage.Person)2