KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > checks > whitespace > TypecastParenPadCheckTest


1 package com.puppycrawl.tools.checkstyle.checks.whitespace;
2
3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
5
6 public class TypecastParenPadCheckTest
7     extends BaseCheckTestCase
8 {
9     public void testDefault()
10         throws Exception JavaDoc
11     {
12         final DefaultConfiguration checkConfig =
13             createCheckConfig(TypecastParenPadCheck.class);
14         final String JavaDoc[] expected = {
15             "89:14: '(' is followed by whitespace.",
16             "89:21: ')' is preceded with whitespace.",
17         };
18         verify(checkConfig, getPath("InputWhitespace.java"), expected);
19     }
20
21     public void testSpace()
22         throws Exception JavaDoc
23     {
24         final DefaultConfiguration checkConfig =
25             createCheckConfig(TypecastParenPadCheck.class);
26         checkConfig.addAttribute("option", PadOption.SPACE.toString());
27         final String JavaDoc[] expected = {
28             "87:21: '(' is not followed by whitespace.",
29             "87:27: ')' is not preceded with whitespace.",
30             "88:14: '(' is not followed by whitespace.",
31             "88:20: ')' is not preceded with whitespace.",
32             "90:14: '(' is not followed by whitespace.",
33             "90:20: ')' is not preceded with whitespace.",
34             "241:18: '(' is not followed by whitespace.",
35             "241:21: ')' is not preceded with whitespace.",
36         };
37         verify(checkConfig, getPath("InputWhitespace.java"), expected);
38     }
39
40     public void test1322879() throws Exception JavaDoc
41     {
42         final DefaultConfiguration checkConfig =
43             createCheckConfig(TypecastParenPadCheck.class);
44         checkConfig.addAttribute("option", PadOption.SPACE.toString());
45         final String JavaDoc[] expected = {
46         };
47         verify(checkConfig, getPath("whitespace/InputWhitespaceAround.java"),
48                expected);
49     }
50 }
51
Popular Tags