1 package com.puppycrawl.tools.checkstyle.checks.design; 2 3 import java.io.File ; 4 5 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; 6 import com.puppycrawl.tools.checkstyle.DefaultConfiguration; 7 8 public class HideUtilityClassConstructorCheckTest 9 extends BaseCheckTestCase 10 { 11 12 public void testUtilClass() throws Exception 13 { 14 final DefaultConfiguration checkConfig = 15 createCheckConfig(HideUtilityClassConstructorCheck.class); 16 final String [] expected = { 17 "11:1: Utility classes should not have a public or default constructor.", 18 }; 19 verify(checkConfig, getPath("InputArrayTypeStyle.java"), expected); 20 } 21 22 23 public void testNonUtilClass() throws Exception 24 { 25 final DefaultConfiguration checkConfig = 26 createCheckConfig(HideUtilityClassConstructorCheck.class); 27 final String [] expected = { 28 }; 29 verify(checkConfig, getPath("InputDesignForExtension.java"), expected); 30 } 31 32 public void testDerivedNonUtilClass() throws Exception 33 { 34 final DefaultConfiguration checkConfig = 35 createCheckConfig(HideUtilityClassConstructorCheck.class); 36 final String [] expected = { 37 }; 38 verify(checkConfig, getPath("design" + File.separator + "InputNonUtilityClass.java"), expected); 39 } 40 41 } 42 | Popular Tags |