moved testinputs for import checks to imports package
This commit is contained in:
parent
70715d7464
commit
748c0102a0
|
|
@ -2,10 +2,10 @@
|
|||
// Test case file for checkstyle.
|
||||
// Created: 2001
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
package com.puppycrawl.tools.checkstyle;
|
||||
package com.puppycrawl.tools.checkstyle.imports;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.*;
|
||||
import com.puppycrawl.tools.checkstyle.GlobalProperties;
|
||||
import com.puppycrawl.tools.checkstyle.imports.*;
|
||||
import com.puppycrawl.tools.checkstyle.imports.GlobalProperties;
|
||||
import java.io.*;
|
||||
import java.lang.*;
|
||||
import java.lang.String;
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
|
|
@ -12,12 +14,12 @@ public class AvoidStarImportTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(AvoidStarImportCheck.class);
|
||||
final String[] expected = {
|
||||
"7: Using the '.*' form of import should be avoided - com.puppycrawl.tools.checkstyle.*.",
|
||||
"7: Using the '.*' form of import should be avoided - com.puppycrawl.tools.checkstyle.imports.*.",
|
||||
"9: Using the '.*' form of import should be avoided - java.io.*.",
|
||||
"10: Using the '.*' form of import should be avoided - java.lang.*.",
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("InputImport.java"), expected);
|
||||
verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected);
|
||||
}
|
||||
|
||||
public void testExcludes()
|
||||
|
|
@ -28,8 +30,8 @@ public class AvoidStarImportTest
|
|||
checkConfig.addAttribute("excludes", "java.io,java.lang");
|
||||
// allow the java.io/java.lang star imports
|
||||
final String[] expected2 = new String[] {
|
||||
"7: Using the '.*' form of import should be avoided - com.puppycrawl.tools.checkstyle.*."
|
||||
"7: Using the '.*' form of import should be avoided - com.puppycrawl.tools.checkstyle.imports.*."
|
||||
};
|
||||
verify(checkConfig, getPath("InputImport.java"), expected2);
|
||||
verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
|
|
@ -17,7 +19,7 @@ extends BaseCheckTestCase
|
|||
"23:1: Import from illegal package - java.io.File.listRoots.",
|
||||
"27:1: Import from illegal package - java.io.File.createTempFile.",
|
||||
};
|
||||
verify(checkConfig, getPath("InputImport.java"), expected);
|
||||
verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected);
|
||||
}
|
||||
|
||||
public void testWithDefault()
|
||||
|
|
@ -29,6 +31,6 @@ extends BaseCheckTestCase
|
|||
"15:1: Import from illegal package - sun.net.ftpclient.FtpClient.",
|
||||
"28:1: Import from illegal package - sun.net.ftpclient.FtpClient.*.",
|
||||
};
|
||||
verify(checkConfig, getPath("InputImport.java"), expected);
|
||||
verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
|
|
@ -12,13 +14,13 @@ public class RedundantImportCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(RedundantImportCheck.class);
|
||||
final String[] expected = {
|
||||
"7:1: Redundant import from the same package - com.puppycrawl.tools.checkstyle.*.",
|
||||
"8:38: Redundant import from the same package - com.puppycrawl.tools.checkstyle.GlobalProperties.",
|
||||
"7:1: Redundant import from the same package - com.puppycrawl.tools.checkstyle.imports.*.",
|
||||
"8:38: Redundant import from the same package - com.puppycrawl.tools.checkstyle.imports.GlobalProperties.",
|
||||
"10:1: Redundant import from the java.lang package - java.lang.*.",
|
||||
"11:1: Redundant import from the java.lang package - java.lang.String.",
|
||||
"14:1: Duplicate import to line 13 - java.util.List.",
|
||||
"26:1: Duplicate import to line 25 - javax.swing.WindowConstants.*."
|
||||
};
|
||||
verify(checkConfig, getPath("InputImport.java"), expected);
|
||||
verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
|
||||
|
|
@ -12,7 +14,7 @@ public class UnusedImportsCheckTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(UnusedImportsCheck.class);
|
||||
final String[] expected = {
|
||||
"8:45: Unused import - com.puppycrawl.tools.checkstyle.GlobalProperties.",
|
||||
"8:45: Unused import - com.puppycrawl.tools.checkstyle.imports.GlobalProperties.",
|
||||
"11:8: Unused import - java.lang.String.",
|
||||
"13:8: Unused import - java.util.List.",
|
||||
"14:8: Unused import - java.util.List.",
|
||||
|
|
@ -23,7 +25,7 @@ public class UnusedImportsCheckTest
|
|||
"29:8: Unused import - java.awt.Component.",
|
||||
"30:8: Unused import - java.awt.Label.",
|
||||
};
|
||||
verify(checkConfig, getPath("InputImport.java"), expected);
|
||||
verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected);
|
||||
}
|
||||
|
||||
public void testAnnotations()
|
||||
|
|
@ -33,6 +35,6 @@ public class UnusedImportsCheckTest
|
|||
createCheckConfig(UnusedImportsCheck.class);
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(checkConfig, getPath("package-info.java"), expected);
|
||||
verify(checkConfig, getPath("imports" + File.separator + "package-info.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue