KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > checks > UncommentedMainCheckTest


1 package com.puppycrawl.tools.checkstyle.checks;
2
3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
5
6 public class UncommentedMainCheckTest
7     extends BaseCheckTestCase
8 {
9     public void testDefaults()
10         throws Exception JavaDoc
11     {
12         final DefaultConfiguration checkConfig =
13             createCheckConfig(UncommentedMainCheck.class);
14         final String JavaDoc[] expected = {
15             "14: Uncommented main method found.",
16             "23: Uncommented main method found.",
17             "32: Uncommented main method found.",
18         };
19         verify(checkConfig, getPath("InputUncommentedMain.java"), expected);
20     }
21
22     public void testExcludedClasses()
23         throws Exception JavaDoc
24     {
25         final DefaultConfiguration checkConfig =
26             createCheckConfig(UncommentedMainCheck.class);
27         checkConfig.addAttribute("excludedClasses", "\\.Main$");
28         final String JavaDoc[] expected = {
29             "14: Uncommented main method found.",
30             "32: Uncommented main method found.",
31         };
32         verify(checkConfig, getPath("InputUncommentedMain.java"), expected);
33     }
34 }
35
Popular Tags