/**
* This method performs all actions mentioned in class description.
*/
public void run() throws Exception {
Throwable serverSideException = new FakeException();
for (int i = 0; i < cases.length; i++) {
Throwable testedException = cases[i];
logger.log(Level.FINEST, "test case: " + testedException);
FakeActivationID aid = new FakeActivationID(logger);
// 1
ExceptionThrowingProxy afup =
new ExceptionThrowingProxy(logger);
// 2
InvocationHandler handler2 = new
ActivatableInvocationHandler(aid, afup);
// 3
ExceptionThrowingInterface fakeProxy =
(ExceptionThrowingInterface) Proxy.newProxyInstance(
ExceptionThrowingInterface.class.getClassLoader(),
new Class[] {ExceptionThrowingInterface.class},
handler2);
// 4
FakeActivationID aid2 = new FakeActivationID(logger, fakeProxy,
true);
// 5
ExceptionThrowingProxy fup = new ExceptionThrowingProxy(logger);
// 6
InvocationHandler handler = new
ActivatableInvocationHandler(aid2, fup);
// 7
ExceptionThrowingInterface fi =
(ExceptionThrowingInterface) Proxy.newProxyInstance(
ExceptionThrowingInterface.class.getClassLoader(),
new Class[] {ExceptionThrowingInterface.class},
handler);
try {
// 8
afup.exceptionForThrow(serverSideException);
// 9
fup.exceptionForThrow(testedException);
// 10
fi.throwsException();
throw new TestException(
serverSideException.toString()
+ " should be thrown");
} catch (Throwable t) {
// 11
assertion(serverSideException.equals(t),
serverSideException.toString()
+ " should be thrown");
}
}
}