01: package com.puppycrawl.tools.checkstyle.checks.metrics;
02:
03: import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
04: import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
05:
06: import java.io.File;
07:
08: public class BooleanExpressionComplexityCheckTest extends
09: BaseCheckTestCase {
10: public void test() throws Exception {
11: DefaultConfiguration checkConfig = createCheckConfig(BooleanExpressionComplexityCheck.class);
12:
13: String[] expected = {
14: "13:9: Boolean expression complexity is 4 (max allowed is 3).",
15: "32:9: Boolean expression complexity is 6 (max allowed is 3).", };
16:
17: verify(checkConfig, getPath("metrics" + File.separator
18: + "BooleanExpressionComplexityCheckTestInput.java"),
19: expected);
20: }
21:
22: public void testNoBitwise() throws Exception {
23: DefaultConfiguration checkConfig = createCheckConfig(BooleanExpressionComplexityCheck.class);
24: checkConfig.addAttribute("max", "5");
25: checkConfig.addAttribute("tokens", "BXOR,LAND,LOR");
26:
27: String[] expected = {};
28:
29: verify(checkConfig, getPath("metrics" + File.separator
30: + "BooleanExpressionComplexityCheckTestInput.java"),
31: expected);
32: }
33: }
|