mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-22 20:47:57 +01:00
Handle junit's AssertionError in integration tests
This commit is contained in:
parent
a85ba5311e
commit
b9782aa6bc
2 changed files with 12 additions and 5 deletions
|
@ -21,9 +21,9 @@ import java.util.List;
|
|||
|
||||
public class FailedTest extends TestResult {
|
||||
|
||||
public final Exception failureReason;
|
||||
public final Throwable failureReason;
|
||||
|
||||
public FailedTest(Method testMethod, long startTime, long endTime, List<String> logMessages, Exception failureReason) {
|
||||
public FailedTest(Method testMethod, long startTime, long endTime, List<String> logMessages, Throwable failureReason) {
|
||||
super(testMethod, startTime, endTime, logMessages);
|
||||
this.failureReason = failureReason;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class SmackIntegrationTestFramework {
|
|||
final Method method = failedTest.testMethod;
|
||||
final String className = method.getDeclaringClass().getName();
|
||||
final String methodName = method.getName();
|
||||
final Exception cause = failedTest.failureReason;
|
||||
final Throwable cause = failedTest.failureReason;
|
||||
LOGGER.severe(className + CLASS_METHOD_SEP + methodName + " failed: " + cause);
|
||||
}
|
||||
System.exit(2);
|
||||
|
@ -380,10 +380,17 @@ public class SmackIntegrationTestFramework {
|
|||
null, (TestNotPossibleException) cause));
|
||||
continue;
|
||||
}
|
||||
Exception nonFatalException = throwFatalException(cause);
|
||||
Throwable nonFatalFailureReason;
|
||||
// junit assert's throw an AssertionError if they fail, those should not be
|
||||
// thrown up, as it would be done by throwFatalException()
|
||||
if (cause instanceof AssertionError) {
|
||||
nonFatalFailureReason = cause;
|
||||
} else {
|
||||
nonFatalFailureReason = throwFatalException(cause);
|
||||
}
|
||||
// An integration test failed
|
||||
testRunResult.failedIntegrationTests.add(new FailedTest(testMethod, testStart, testEnd, null,
|
||||
nonFatalException));
|
||||
nonFatalFailureReason));
|
||||
LOGGER.log(Level.SEVERE, testPrefix + "Failed", e);
|
||||
}
|
||||
catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
|
|
Loading…
Reference in a new issue