1 package com.puppycrawl.tools.checkstyle.checks.coding; 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 JUnitTestCaseCheckTest extends BaseCheckTestCase 9 { 10 public void testDefault() throws Exception 11 { 12 DefaultConfiguration checkConfig = createCheckConfig(JUnitTestCaseCheck.class); 13 14 String [] expected = { 15 "14:5: The method 'setUp' must be public or protected.", 16 "15:5: The method 'tearDown' shouldn't be static.", 17 "16:5: The method 'suite' must be declared static.", 18 "21:5: The method 'SetUp' should be named 'setUp'.", 19 "22:5: The method 'tearDown' must be declared with a void return type.", 20 "23:5: The method 'suite' must be declared with a junit.framework.Test return type.", 21 "28:5: The method 'setUp' must be declared with no parameters.", 22 "30:5: The method 'suite' must be declared static.", 23 "31:5: The method 'tearDown' must be declared with no parameters.", 24 }; 25 26 verify(checkConfig, getPath("coding" + File.separator + "InputJUnitTest.java"), expected); 27 } 28 } 29 | Popular Tags |