diff options
Diffstat (limited to 'src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/npathcomplexity/InputNPathComplexityDefault.java')
-rw-r--r-- | src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/npathcomplexity/InputNPathComplexityDefault.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/npathcomplexity/InputNPathComplexityDefault.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/npathcomplexity/InputNPathComplexityDefault.java index 390d4dd44..fe4a52a08 100644 --- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/npathcomplexity/InputNPathComplexityDefault.java +++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/metrics/npathcomplexity/InputNPathComplexityDefault.java @@ -109,4 +109,17 @@ public class InputNPathComplexityDefault { }; new Thread(runnable).start(); } + + public void InputNestedTernaryCheck() { + double x = (getSmth() || Math.random() == 5) ? null : (int) Math + .cos(400 * (10 + 40)); // good + double y = (0.2 == Math.random()) ? (0.3 == Math.random()) ? null : (int) Math + .cos(400 * (10 + 40)) : 6; // bad (nested in first position) + double z = (Integer) ((0.2 == Math.random()) ? (Integer) null + apply(null) + : (0.3 == Math.random()) ? (Integer) null : (int) Math + .sin(300 * (12 + 30))); // bad (nested in second + // position) + } + public boolean getSmth() { return true; }; + public int apply(Object o) { return 0; } } |