1 package com.puppycrawl.tools.checkstyle.checks.imports; 2 3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; 4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration; 5 6 public class AvoidStarImportTest 7 extends BaseCheckTestCase 8 { 9 public void testDefaultOperation() 10 throws Exception 11 { 12 final DefaultConfiguration checkConfig = 13 createCheckConfig(AvoidStarImportCheck.class); 14 final String [] expected = { 15 "7: Using the '.*' form of import should be avoided - com.puppycrawl.tools.checkstyle.*.", 16 "9: Using the '.*' form of import should be avoided - java.io.*.", 17 "10: Using the '.*' form of import should be avoided - java.lang.*.", 18 }; 19 20 verify(checkConfig, getPath("InputImport.java"), expected); 21 } 22 23 public void testExcludes() 24 throws Exception 25 { 26 final DefaultConfiguration checkConfig = 27 createCheckConfig(AvoidStarImportCheck.class); 28 checkConfig.addAttribute("excludes", "java.io,java.lang"); 29 final String [] expected2 = new String [] { 31 "7: Using the '.*' form of import should be avoided - com.puppycrawl.tools.checkstyle.*." 32 }; 33 verify(checkConfig, getPath("InputImport.java"), expected2); 34 } 35 } 36 | Popular Tags |