Source code: com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheckTest.java
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 IllegalImportCheckTest
7 extends BaseCheckTestCase
8 {
9 public void testWithSupplied()
10 throws Exception
11 {
12 final DefaultConfiguration checkConfig =
13 createCheckConfig(IllegalImportCheck.class);
14 checkConfig.addAttribute("illegalPkgs", "java.io");
15 final String[] expected = {
16 "9:1: Import from illegal package - java.io.*.",
17 };
18 verify(checkConfig, getPath("InputImport.java"), expected);
19 }
20
21 public void testWithDefault()
22 throws Exception
23 {
24 final DefaultConfiguration checkConfig =
25 createCheckConfig(IllegalImportCheck.class);
26 final String[] expected = {
27 "15:1: Import from illegal package - sun.net.ftpclient.FtpClient.",
28 };
29 verify(checkConfig, getPath("InputImport.java"), expected);
30 }
31 }