KickJava   Java API By Example, From Geeks To Geeks.

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


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 public class IllegalInstantiationCheckTest
7     extends BaseCheckTestCase
8 {
9     public void testIt() throws Exception JavaDoc
10     {
11         final DefaultConfiguration checkConfig =
12             createCheckConfig(IllegalInstantiationCheck.class);
13         checkConfig.addAttribute(
14             "classes",
15             "java.lang.Boolean,"
16                 + "com.puppycrawl.tools.checkstyle.InputModifier,"
17                 + "java.io.File,"
18                 + "java.awt.Color");
19         final String JavaDoc[] expected = {
20             "19:21: Instantiation of java.lang.Boolean should be avoided.",
21             "24:21: Instantiation of java.lang.Boolean should be avoided.",
22             "31:16: Instantiation of java.lang.Boolean should be avoided.",
23             "38:21: Instantiation of " +
24                 "com.puppycrawl.tools.checkstyle.InputModifier " +
25                 "should be avoided.",
26             "41:18: Instantiation of java.io.File should be avoided.",
27             "44:21: Instantiation of java.awt.Color should be avoided."
28         };
29         verify(checkConfig, getPath("InputSemantic.java"), expected);
30     }
31 }
32
Popular Tags