1 package com.puppycrawl.tools.checkstyle.checks.design; 2 3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; 4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration; 5 6 import java.io.File ; 7 8 public class ThrowsCountCheckTest extends BaseCheckTestCase { 9 public void testDefault() throws Exception { 10 DefaultConfiguration checkConfig = createCheckConfig(ThrowsCountCheck.class); 11 12 String [] expected = { 13 "14:20: Throws count is 2 (max allowed is 1).", 14 "18:20: Throws count is 2 (max allowed is 1).", 15 "22:20: Throws count is 3 (max allowed is 1).", 16 }; 17 18 verify(checkConfig, getPath("design" + File.separator + "InputThrowsCount.java"), expected); 19 } 20 21 public void testMax() throws Exception { 22 DefaultConfiguration checkConfig = createCheckConfig(ThrowsCountCheck.class); 23 checkConfig.addAttribute("max", "2"); 24 25 String [] expected = { 26 "22:20: Throws count is 3 (max allowed is 2).", 27 }; 28 29 verify(checkConfig, getPath("design" + File.separator + "InputThrowsCount.java"), expected); 30 } 31 } 32 | Popular Tags |