diff options
Diffstat (limited to 'sonar-testing-harness/src')
-rw-r--r-- | sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java b/sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java index 9eaf1d6923c..803e3527180 100644 --- a/sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java +++ b/sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java @@ -64,8 +64,13 @@ public class ExceptionCauseMatcher extends TypeSafeMatcher<Throwable> { @Override protected boolean matchesSafely(Throwable item) { - return item.getClass().isAssignableFrom(type) - && (expectedMessage == null || EXPECT_NO_MESSAGE_CONSTANT.equals(expectedMessage) ? item.getMessage() == null : item.getMessage().contains(expectedMessage)); + if (!item.getClass().isAssignableFrom(type)) { + return false; + } + if (expectedMessage == null) { + return true; + } + return EXPECT_NO_MESSAGE_CONSTANT.equals(expectedMessage) ? item.getMessage() == null : item.getMessage().contains(expectedMessage); } @Override |