diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-12-07 10:04:13 +0100 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-12-07 10:04:13 +0100 |
commit | 6799c6936b4b53f513e6adcd54c81beffb887719 (patch) | |
tree | f2adf60727577f242649eb3af05a12539ea2b55a /sonar-testing-harness/src | |
parent | d9f11d294531fc2c628a27463f29ab5c92af0c90 (diff) | |
download | sonarqube-6799c6936b4b53f513e6adcd54c81beffb887719.tar.gz sonarqube-6799c6936b4b53f513e6adcd54c81beffb887719.zip |
fix quality flaws
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 |