Skip to content

Commit

Permalink
Issue checkstyle#4437: Arranged the remaining files from 'imports' di…
Browse files Browse the repository at this point in the history
…rectory and modified the test and input files based on the rearrangement
  • Loading branch information
Subbu Dantu authored and Subbu Dantu committed Jun 26, 2017
1 parent a83475a commit a1988ec
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 50 deletions.
Expand Up @@ -680,7 +680,8 @@ public void testCacheAndCheckWhichAddsNewResourceLocationButKeepsSameCheckerInst

final DynamicalResourceHolderCheck check = new DynamicalResourceHolderCheck();
final String firstExternalResourceLocation = getPath("checks" + File.separator
+ "imports" + File.separator + "import-control_one.xml");
+ "imports" + File.separator + "importcontrol"
+ File.separator + "InputImportControlOne.xml");
final String firstExternalResourceKey = PropertyCacheFile.EXTERNAL_RESOURCE_KEY_PREFIX
+ firstExternalResourceLocation;
check.setFirstExternalResourceLocation(firstExternalResourceLocation);
Expand Down Expand Up @@ -708,7 +709,8 @@ public void testCacheAndCheckWhichAddsNewResourceLocationButKeepsSameCheckerInst

// Change a list of external resources which are used by the check
final String secondExternalResourceLocation = "checks" + File.separator
+ "imports" + File.separator + "import-control_one-re.xml";
+ "imports" + File.separator + "importcontrol"
+ File.separator + "InputImportControlOneRegExp.xml";
final String secondExternalResourceKey = PropertyCacheFile.EXTERNAL_RESOURCE_KEY_PREFIX
+ secondExternalResourceLocation;
check.setSecondExternalResourceLocation(secondExternalResourceLocation);
Expand Down
Expand Up @@ -60,10 +60,10 @@ public void testDefaultOperation()
"28: " + getCheckMessage(MSG_KEY, "java.io.File.pathSeparator"),
"29: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass.one"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};

verify(checkConfig, getPath("InputAvoidStaticImportDefault.java"), expected);
Expand All @@ -81,10 +81,10 @@ public void testStarExcludes()
"26: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"29: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass.one"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
verify(checkConfig, getPath("InputAvoidStaticImportDefault.java"), expected);
}
Expand All @@ -103,10 +103,10 @@ public void testMemberExcludes()
"28: " + getCheckMessage(MSG_KEY, "java.io.File.pathSeparator"),
"29: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass.one"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
verify(checkConfig, getPath("InputAvoidStaticImportDefault.java"), expected);
}
Expand All @@ -131,10 +131,10 @@ public void testBogusMemberExcludes()
"28: " + getCheckMessage(MSG_KEY, "java.io.File.pathSeparator"),
"29: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass.one"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
verify(checkConfig, getPath("InputAvoidStaticImportDefault.java"), expected);
}
Expand All @@ -145,12 +145,12 @@ public void testInnerClassMemberExcludesStar()
final DefaultConfiguration checkConfig =
createCheckConfig(AvoidStaticImportCheck.class);

// should mask com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.
// InnerClass.one
// should mask com.puppycrawl.tools.checkstyle.imports.avoidstaticimport.
// InputAvoidStaticImportNestedClass.InnerClass.one
checkConfig.addAttribute(
"excludes",
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass.*");
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.*");
final String[] expected = {
"23: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"),
"25: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
Expand All @@ -159,7 +159,7 @@ public void testInnerClassMemberExcludesStar()
"28: " + getCheckMessage(MSG_KEY, "java.io.File.pathSeparator"),
"29: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "InputAvoidStaticImportNestedClass.InnerClass"),
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
};
verify(checkConfig, getPath("InputAvoidStaticImportDefault.java"), expected);
}
Expand Down
Expand Up @@ -51,7 +51,7 @@ public void testWithoutProcessJavadoc() throws Exception {
checkConfig.addAttribute("processJavadoc", "false");
final String[] expected = {
"8:45: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug"),
"com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.InputUnusedImportsBug"),
"11:8: " + getCheckMessage(MSG_KEY, "java.lang.String"),
"13:8: " + getCheckMessage(MSG_KEY, "java.util.List"),
"14:8: " + getCheckMessage(MSG_KEY, "java.util.List"),
Expand Down Expand Up @@ -89,7 +89,7 @@ public void testProcessJavadoc() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);
final String[] expected = {
"8:45: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug"),
"com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.InputUnusedImportsBug"),
"11:8: " + getCheckMessage(MSG_KEY, "java.lang.String"),
"13:8: " + getCheckMessage(MSG_KEY, "java.util.List"),
"14:8: " + getCheckMessage(MSG_KEY, "java.util.List"),
Expand Down
Expand Up @@ -26,8 +26,8 @@
import static javax.swing.WindowConstants.*;
import static java.io.File.createTempFile;
import static java.io.File.pathSeparator;
import static com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass;
import static com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass.one;
import static com.puppycrawl.tools.checkstyle.checks.imports.avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass;
import static com.puppycrawl.tools.checkstyle.checks.imports.avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one;

import java.awt.Component;
import java.awt.Graphics2D;
Expand Down
@@ -1,4 +1,4 @@
package com.puppycrawl.tools.checkstyle.checks.imports;
package com.puppycrawl.tools.checkstyle.checks.imports.avoidstaticimport;

public class InputAvoidStaticImportNestedClass{
public static Integer zero=0;
Expand Down

This file was deleted.

This file was deleted.

@@ -1,12 +1,12 @@
package com.puppycrawl.tools.checkstyle.checks.imports;
package com.puppycrawl.tools.checkstyle.checks.imports.importorder;

import java.net.URL;

public class InputImportBug {
public class InputImportOrderBug {
//same as a class name
private static String URL = "This is a String object";

public InputImportBug() throws Exception {
public InputImportOrderBug() throws Exception {
URL url = new URL("file://this.is.a.url.object");
}
}
Expand Up @@ -8,7 +8,7 @@
import java.io.IOException;
import java.util.Iterator;

import com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug;
import com.puppycrawl.tools.checkstyle.checks.imports.importorder.InputImportOrderBug;

public class InputImportOrder_WildcardUnspecified {
}
Expand Up @@ -5,7 +5,7 @@
package com.puppycrawl.tools.checkstyle.checks.imports.unusedimports;

import com.puppycrawl.tools.checkstyle.checks.imports.*;
import com.puppycrawl.tools.checkstyle.checks.imports.InputImportBug;
import com.puppycrawl.tools.checkstyle.checks.imports.unusedimports.InputUnusedImportsBug;
import java.io.*;
import java.lang.*;
import java.lang.String;
Expand Down

0 comments on commit a1988ec

Please sign in to comment.