1 package com.puppycrawl.tools.checkstyle.checks.coding; 2 3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; 4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration; 5 6 public class NestedIfDepthCheckTest extends BaseCheckTestCase 7 { 8 public void testDefault() throws Exception 9 { 10 final DefaultConfiguration checkConfig = 11 createCheckConfig(NestedIfDepthCheck.class); 12 13 final String [] expected = { 14 "17:17: Nested if-else depth is 2 (max allowed is 1).", 15 "43:17: Nested if-else depth is 2 (max allowed is 1).", 16 }; 17 18 verify(checkConfig, getPath("coding/InputNestedIfDepth.java"), expected); 19 } 20 22 public void testCustomNestingDepth() throws Exception 23 { 24 final DefaultConfiguration checkConfig = 25 createCheckConfig(NestedIfDepthCheck.class); 26 checkConfig.addAttribute("max", "2"); 27 28 final String [] expected = { 29 }; 30 31 verify(checkConfig, getPath("coding/InputNestedIfDepth.java"), expected); 32 } 33 } 34 | Popular Tags |