1 package com.puppycrawl.tools.checkstyle.checks.sizes; 20 21 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; 22 import com.puppycrawl.tools.checkstyle.DefaultConfiguration; 23 import com.puppycrawl.tools.checkstyle.checks.sizes.AnonInnerLengthCheck; 24 25 29 public class AnonInnerLengthCheckTest extends BaseCheckTestCase 30 { 31 32 public void testDefault() throws Exception 33 { 34 final DefaultConfiguration checkConfig = 35 createCheckConfig(AnonInnerLengthCheck.class); 36 final String [] expected = { 37 "50:35: Anonymous inner class length is 21 lines (max allowed is 20).", 38 }; 39 verify(checkConfig, getPath("InputAnonInnerLength.java"), expected); 40 } 41 42 public void testNonDefault() throws Exception 43 { 44 final DefaultConfiguration checkConfig = 45 createCheckConfig(AnonInnerLengthCheck.class); 46 checkConfig.addAttribute("max", "6"); 47 final String [] expected = { 48 "50:35: Anonymous inner class length is 21 lines (max allowed is 6).", 49 "75:35: Anonymous inner class length is 20 lines (max allowed is 6).", 50 }; 51 verify(checkConfig, getPath("InputAnonInnerLength.java"), expected); 52 } 53 } 54 | Popular Tags |