From 6799c6936b4b53f513e6adcd54c81beffb887719 Mon Sep 17 00:00:00 2001 From: Sébastien Lesaint Date: Mon, 7 Dec 2015 10:04:13 +0100 Subject: fix quality flaws --- .../src/main/java/org/sonar/test/ExceptionCauseMatcher.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sonar-testing-harness/src') 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 { @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 -- cgit v1.2.3