KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > puppycrawl > tools > checkstyle > checks > imports > UnusedImportsCheckTest


1 package com.puppycrawl.tools.checkstyle.checks.imports;
2
3 import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
4 import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
5
6 public class UnusedImportsCheckTest
7     extends BaseCheckTestCase
8 {
9     public void testDefault()
10         throws Exception JavaDoc
11     {
12         final DefaultConfiguration checkConfig =
13             createCheckConfig(UnusedImportsCheck.class);
14         final String JavaDoc[] expected = {
15             "8:45: Unused import - com.puppycrawl.tools.checkstyle.GlobalProperties.",
16             "11:8: Unused import - java.lang.String.",
17             "13:8: Unused import - java.util.List.",
18             "14:8: Unused import - java.util.List.",
19             "17:8: Unused import - java.util.Enumeration.",
20             "20:8: Unused import - javax.swing.JToggleButton.",
21             "22:8: Unused import - javax.swing.BorderFactory.",
22             "27:15: Unused import - java.io.File.createTempFile.",
23             "29:8: Unused import - java.awt.Component.",
24             "30:8: Unused import - java.awt.Label.",
25         };
26         verify(checkConfig, getPath("InputImport.java"), expected);
27     }
28
29     public void testAnnotations()
30         throws Exception JavaDoc
31     {
32         final DefaultConfiguration checkConfig =
33             createCheckConfig(UnusedImportsCheck.class);
34         final String JavaDoc[] expected = {
35         };
36         verify(checkConfig, getPath("package-info.java"), expected);
37     }
38 }
39
Popular Tags