[sinttest] Treat NPE as test failure not as abort condition

This commit is contained in:
Florian Schmaus 2021-07-16 08:55:40 +02:00
parent c9af25c674
commit f64288ba6d
1 changed files with 8 additions and 0 deletions

View File

@ -590,6 +590,14 @@ public class SmackIntegrationTestFramework {
if (e instanceof InterruptedException) {
throw (InterruptedException) e;
}
// We handle NullPointerException as a non fatal exception, as they are mostly caused by an invalid reply where
// a extension element is missing. Consider for example
// assertEquals(StanzaError.Condition.foo, response.getError().getCondition())
// Otherwise NPEs could be caused by an internal bug in Smack, e.g. missing null handling.
if (e instanceof NullPointerException) {
return (NullPointerException) e;
}
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}