boolean equalInvocationHandlers =
((Boolean) cases[i][2]).booleanValue();
// create a dynamic proxy for proxy1Interfaces
FakeActivationID aid = new FakeActivationID(null);
ActivatableInvocationHandler handler1 = new
ActivatableInvocationHandler(aid, null);
Object proxy1 = Proxy.newProxyInstance(
this.getClass().getClassLoader(),
proxy1Interfaces,
handler1);
// create a dynamic proxy for proxy2Interfaces
FakeActivationID aid2 = aid;
if (!equalInvocationHandlers) {
aid2 = new FakeActivationID(null);
}
ActivatableInvocationHandler handler2 = new
ActivatableInvocationHandler(aid2, null);
Object proxy2 = Proxy.newProxyInstance(
this.getClass().getClassLoader(),
proxy2Interfaces,
handler2);
// verify ActivatableInvocationHandler.invoke equals, hashCode,
// and toString methods
if (equalInvocationHandlers
&& Arrays.equals(proxy1Interfaces, proxy2Interfaces)) {
assertion(proxy1.equals(proxy2));
assertion(proxy2.equals(proxy1));
assertion(proxy1.equals(proxy1));
assertion(proxy2.equals(proxy2));
assertion(proxy1.hashCode() == proxy2.hashCode());
} else {
assertion(!proxy1.equals(proxy2));
assertion(!proxy2.equals(proxy1));
}
assertion(proxy1.toString() != null);
assertion(proxy2.toString() != null);
// verify ActivatableInvocationHandler equals, hashCode,
// and toString methods
if (equalInvocationHandlers) {
assertion(handler1.equals(handler2));
assertion(handler2.equals(handler1));
assertion(handler1.equals(handler1));
assertion(handler2.equals(handler2));
assertion(handler1.hashCode() == handler2.hashCode());
} else {
assertion(!handler1.equals(handler2));
assertion(!handler2.equals(handler1));
assertion(!handler1.equals(new Object()));
}
assertion(handler1.toString() != null);
assertion(handler2.toString() != null);
}
}