KickJava   Java API By Example, From Geeks To Geeks.

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


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 TrailingCommentCheckTest extends BaseCheckTestCase
7 {
8     DefaultConfiguration mCheckConfig;
9     
10     public void setUp() {
11         mCheckConfig = createCheckConfig(TrailingCommentCheck.class);
12     }
13
14     public void testDefaults() throws Exception JavaDoc
15     {
16         final String JavaDoc[] expected = {
17             "2: Don't use trailing comments.",
18             "5: Don't use trailing comments.",
19             "6: Don't use trailing comments.",
20             "16: Don't use trailing comments.",
21             "17: Don't use trailing comments.",
22             "27: Don't use trailing comments.",
23         };
24         verify(mCheckConfig, getPath("InputTrailingComment.java"), expected);
25     }
26
27     public void testLegalComment() throws Exception JavaDoc
28     {
29         mCheckConfig.addAttribute("legalComment", "^NOI18N$");
30         final String JavaDoc[] expected = {
31             "2: Don't use trailing comments.",
32             "5: Don't use trailing comments.",
33             "6: Don't use trailing comments.",
34             "16: Don't use trailing comments.",
35             "17: Don't use trailing comments.",
36         };
37         verify(mCheckConfig, getPath("InputTrailingComment.java"), expected);
38     }
39 }
40
Popular Tags