KickJava   Java API By Example, From Geeks To Geeks.

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


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 OperatorWrapCheckTest
7     extends BaseCheckTestCase
8 {
9     private DefaultConfiguration checkConfig;
10
11     public void setUp() {
12         checkConfig = createCheckConfig(OperatorWrapCheck.class);
13     }
14
15     public void testDefault()
16         throws Exception JavaDoc
17     {
18         final String JavaDoc[] expected = {
19             "15:19: '+' should be on a new line.",
20             "16:15: '-' should be on a new line.",
21             "24:18: '&&' should be on a new line.",
22
23         };
24         verify(checkConfig, getPath("InputOpWrap.java"), expected);
25     }
26
27     public void testOpWrapEOL()
28         throws Exception JavaDoc
29     {
30         checkConfig.addAttribute("option", OperatorWrapOption.EOL.toString());
31         final String JavaDoc[] expected = {
32             "18:13: '-' should be on the previous line.",
33             "22:13: '&&' should be on the previous line.",
34             "27:13: '&&' should be on the previous line.",
35         };
36         verify(checkConfig, getPath("InputOpWrap.java"), expected);
37     }
38
39     public void testAssignEOL()
40         throws Exception JavaDoc
41     {
42         checkConfig.addAttribute("tokens", "ASSIGN");
43         checkConfig.addAttribute("option", OperatorWrapOption.EOL.toString());
44         final String JavaDoc[] expected = {
45             "33:13: '=' should be on the previous line.",
46         };
47         verify(checkConfig, getPath("InputOpWrap.java"), expected);
48     }
49 }
50
Popular Tags