* Compares the input exception with the expected exception
* If they match, then the test passes. Otherwise, the test fails
*/
protected TestReport handleException(Exception e) {
if (!e.getClass().getName().equals(expectedExceptionClass)) {
TestReport report = reportError(ERROR_UNEXPECTED_EXCEPTION);
report.addDescriptionEntry(ENTRY_KEY_UNEXPECTED_EXCEPTION,
e.getClass().getName());
report.addDescriptionEntry(ENTRY_KEY_EXPECTED_EXCEPTION,
expectedExceptionClass);
return report;
} else {
if (!ERROR_CODE_NO_CHECK.equals(expectedErrorCode)
&& e instanceof BridgeException) {
if ( !expectedErrorCode.equals(((BridgeException)e).getCode()) ) {
TestReport report = reportError(ERROR_UNEXPECTED_ERROR_CODE);
report.addDescriptionEntry(ENTRY_KEY_UNEXPECTED_ERROR_CODE,
((BridgeException)e).getCode());
report.addDescriptionEntry(ENTRY_KEY_EXPECTED_ERROR_CODE,
expectedErrorCode);
return report;
}
}
return reportSuccess();