void (TestFailedState failedState) { if (myState instanceof CompoundTestFailedState) { ((CompoundTestFailedState)myState).addFailure(failedState); } else if (myState instanceof TestFailedState) { CompoundTestFailedState states = new CompoundTestFailedState(); states.addFailure((TestFailedState)myState); states.addFailure(failedState); myState = states; } else { myState = failedState; } }