JavaSpaceInterceptor si = new JavaSpaceInterceptor(template);
si.setSynchronous(false);
ProxyFactory pf = new ProxyFactory(new Class[] { ITestBean.class });
pf.addAdvice(new PerformanceMonitorInterceptor());
pf.addAdvice(si);
ITestBean proxy = (ITestBean) pf.getProxy();
// nothing before the call
assertNull(template.getSpace().readIfExists(new MethodResultEntry(), template.getCurrentTransaction(), 100));
ITestBean lazyResult = proxy.getSpouse();
System.out.println("spouse name is " + lazyResult.getClass());
assertTrue(AopUtils.isCglibProxyClass(lazyResult.getClass()));
System.out.println("should not be initialized");
System.out.println(lazyResult.getClass());
System.out.println(lazyResult.hashCode());
System.out.println("should not be initialized");
System.out.println(lazyResult);
System.out.println("should be initialized");
assertEquals("kerry", lazyResult.getName());
}