KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > checks > metrics > NPathComplexityCheckTest


1 package com.puppycrawl.tools.checkstyle.checks.metrics;
2
3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
5
6 public class NPathComplexityCheckTest extends BaseCheckTestCase {
7     public void test() throws Exception JavaDoc {
8         DefaultConfiguration checkConfig =
9             createCheckConfig(NPathComplexityCheck.class);
10
11         checkConfig.addAttribute("max", "0");
12         String JavaDoc[] expected = {
13             "4:5: NPath Complexity is 2 (max allowed is 0).",
14             "7:17: NPath Complexity is 2 (max allowed is 0).",
15             "17:5: NPath Complexity is 5 (max allowed is 0).",
16             "27:5: NPath Complexity is 3 (max allowed is 0).",
17             "34:5: NPath Complexity is 7 (max allowed is 0).",
18             "48:5: NPath Complexity is 3 (max allowed is 0).",
19             "58:5: NPath Complexity is 3 (max allowed is 0).",
20             "67:5: NPath Complexity is 3 (max allowed is 0).",
21             "76:5: NPath Complexity is 1 (max allowed is 0).",
22             "79:13: NPath Complexity is 2 (max allowed is 0).",
23         };
24
25         verify(checkConfig, getPath("ComplexityCheckTestInput.java"), expected);
26     }
27 }
28
Popular Tags