diff options
author | Michal Kordas <kordas.michal@gmail.com> | 2015-09-03 23:57:38 +0200 |
---|---|---|
committer | Roman Ivanov <ivanov-jr@mail.ru> | 2015-09-03 18:07:24 -0700 |
commit | f7e41edb947dad22e10eeaa2e68e6f44b4bfa747 (patch) | |
tree | bc29f58735c023c31df3195f2c818671ffbca598 /src/it | |
parent | 2b4a02d2c8a498a8a1ee38e9396426209fa65fad (diff) | |
download | checkstyle-f7e41edb947dad22e10eeaa2e68e6f44b4bfa747.tar.gz |
Issue #2080: Replace ternary condition operator with if
Fixes `ConditionalExpression` inspection violations.
Description:
>Reports the ternary condition operator. Some coding standards prohibit the use of the condition operator, in favor of if-else statements.
Diffstat (limited to 'src/it')
-rw-r--r-- | src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java b/src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java index cd3387670..09fc5b09c 100644 --- a/src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java +++ b/src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java @@ -123,7 +123,10 @@ public abstract class BaseCheckTestSupport parseInt = parseInt.substring(parseInt.indexOf(':') + 1); parseInt = parseInt.substring(0, parseInt.indexOf(':')); int lineNumber = Integer.parseInt(parseInt); - Integer integer = Arrays.asList(aWarnsExpected).contains(lineNumber) ? lineNumber : 0; + Integer integer = 0; + if (Arrays.asList(aWarnsExpected).contains(lineNumber)) { + integer = lineNumber; + } assertEquals("error message " + i, (long) integer, lineNumber); } |