1 package com.puppycrawl.tools.checkstyle.checks.metrics; 2 3 import java.io.File ; 4 5 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; 6 import com.puppycrawl.tools.checkstyle.DefaultConfiguration; 7 8 13 public class JavaNCSSCheckTest extends BaseCheckTestCase { 14 15 public void test() throws Exception { 16 DefaultConfiguration checkConfig = createCheckConfig(JavaNCSSCheck.class); 17 18 checkConfig.addAttribute("methodMaximum", "0"); 19 checkConfig.addAttribute("classMaximum", "0"); 20 checkConfig.addAttribute("fileMaximum", "0"); 21 22 String [] expected = { 23 "2:1: NCSS for this file is 35 (max allowed is 0).", 24 "9:1: NCSS for this class is 22 (max allowed is 0).", 25 "14:5: NCSS for this method is 2 (max allowed is 0).", 26 "21:5: NCSS for this method is 4 (max allowed is 0).", 27 "30:5: NCSS for this method is 12 (max allowed is 0).", 28 "42:13: NCSS for this method is 2 (max allowed is 0).", 29 "49:5: NCSS for this class is 2 (max allowed is 0).", 30 "56:1: NCSS for this class is 10 (max allowed is 0).", 31 "61:5: NCSS for this method is 8 (max allowed is 0).",}; 32 33 verify(checkConfig, getPath("metrics" + File.separator 34 + "JavaNCSSCheckTestInput.java"), expected); 35 } 36 } 37 | Popular Tags |