Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java


1   package com.puppycrawl.tools.checkstyle.checks.blocks;
2   
3   import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
4   import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
5   
6   public class RightCurlyCheckTest
7       extends BaseCheckTestCase
8   {
9       public void testDefault()
10          throws Exception
11      {
12          final DefaultConfiguration checkConfig =
13              createCheckConfig(RightCurlyCheck.class);
14          final String[] expected = {
15              "25:17: '}' should be on the same line.",
16              "28:17: '}' should be on the same line.",
17              "40:13: '}' should be on the same line.",
18              "44:13: '}' should be on the same line.",
19          };
20          verify(checkConfig, getPath("InputLeftCurlyOther.java"), expected);
21      }
22  
23      public void testSame()
24          throws Exception
25      {
26          final DefaultConfiguration checkConfig =
27              createCheckConfig(RightCurlyCheck.class);
28          checkConfig.addAttribute("option", RightCurlyOption.SAME.toString());
29          final String[] expected = {
30              "25:17: '}' should be on the same line.",
31              "28:17: '}' should be on the same line.",
32              "40:13: '}' should be on the same line.",
33              "44:13: '}' should be on the same line.",
34          };
35          verify(checkConfig, getPath("InputLeftCurlyOther.java"), expected);
36      }
37  
38      public void testAlone()
39          throws Exception
40      {
41          final DefaultConfiguration checkConfig =
42              createCheckConfig(RightCurlyCheck.class);
43          checkConfig.addAttribute("option", RightCurlyOption.ALONE.toString());
44          final String[] expected = {
45          };
46          verify(checkConfig, getPath("InputLeftCurlyOther.java"), expected);
47      }
48  }