// the handler instance to validate
// NOTE:must execute before the handler that throws the fault
TestHandler testHandler = null;
try {
SimpleChain c = new SimpleChain();
for (int i = 0; i < 5; i++) {
TestHandler th = new TestHandler(i);
if (i == 2)
testHandler = th;
if (i == 3) {
th.setToFault();
}
c.addHandler(th);
}
TestMessageContext mc = new TestMessageContext();
try {
c.invoke(mc);
assertTrue("Testcase error - didn't throw fault", false);
} catch (AxisFault f) {
// did we save off the fault string?
assertEquals("faultstring does not match constant",
testHandler.getFaultCatch(),TestChainFault.FAULT_MESSAGE);