* Tests lazy init proxy to represent interfaces
*/
public void testInterfaceProxy()
{
// test proxy creation for an interface class
IInterface proxy = (IInterface) LazyInitProxyFactory.createProxy(
IInterface.class, interfaceObjectLocator);
// test we have a jdk dynamic proxy
assertTrue(Proxy.isProxyClass(proxy.getClass()));
// test proxy implements ILazyInitProxy
assertTrue(proxy instanceof ILazyInitProxy);
assertTrue(((ILazyInitProxy) proxy).getObjectLocator() == interfaceObjectLocator);
// test method invocation
assertEquals(proxy.getMessage(), "interface");
// test serialization
IInterface proxy2 = (IInterface) Objects.cloneObject(proxy);
assertTrue(proxy != proxy2);
assertEquals(proxy2.getMessage(), "interface");
// test equals/hashcode method interception
final IObjectMethodTester tester = new ObjectMethodTester();
assertTrue(tester.isValid());