KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > checks > coding > MultipleVariableDeclarationsCheckTest


1 package com.puppycrawl.tools.checkstyle.checks.coding;
2
3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
5
6 import java.io.File JavaDoc;
7
8 public class MultipleVariableDeclarationsCheckTest extends BaseCheckTestCase
9 {
10     public void testIt() throws Exception JavaDoc
11     {
12         DefaultConfiguration checkConfig =
13             createCheckConfig(MultipleVariableDeclarationsCheck.class);
14
15         final String JavaDoc[] expected = {
16             "3:5: Each variable declaration must be in its own statement.",
17             "4:5: Only one variable definition per line allowed.",
18             "7:9: Each variable declaration must be in its own statement.",
19             "8:9: Only one variable definition per line allowed.",
20             "12:5: Only one variable definition per line allowed.",
21             "15:5: Only one variable definition per line allowed.",
22             "20:14: Each variable declaration must be in its own statement.",
23         };
24
25         verify(checkConfig,
26                getPath("coding" + File.separator + "InputMultipleVariableDeclarations.java"),
27                expected);
28     }
29 }
30
Popular Tags