aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-testing-harness
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-12-07 10:04:13 +0100
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-12-07 10:04:13 +0100
commit6799c6936b4b53f513e6adcd54c81beffb887719 (patch)
treef2adf60727577f242649eb3af05a12539ea2b55a /sonar-testing-harness
parentd9f11d294531fc2c628a27463f29ab5c92af0c90 (diff)
downloadsonarqube-6799c6936b4b53f513e6adcd54c81beffb887719.tar.gz
sonarqube-6799c6936b4b53f513e6adcd54c81beffb887719.zip
fix quality flaws
Diffstat (limited to 'sonar-testing-harness')
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/ExceptionCauseMatcher.java9
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