Issue #1566: Fixed TrailingComment violations in UTs

This commit is contained in:
Baratali Izmailov 2015-08-22 05:22:09 -04:00 committed by Roman Ivanov
parent 80f66e1c88
commit ee797434bc
8 changed files with 36 additions and 13 deletions

View File

@ -38,8 +38,11 @@ public enum LineSeparatorOption {
/** Unix-style line separators. **/
LF("\n"),
/** Matches CR, LF and CRLF line separators. **/
LF_CR_CRLF("##"), // only the length is used - the actual value is ignored
/**
* Matches CR, LF and CRLF line separators.
* Only the length is used - the actual value is ignored.
*/
LF_CR_CRLF("##"),
/** System default line separators. **/
SYSTEM(System.getProperty("line.separator"));

View File

@ -47,7 +47,8 @@ public class CheckerTest {
final DebugFilter filter = new DebugFilter();
checker.addFilter(filter);
checker.destroy(); // should remove al listeners and filters
// should remove al listeners and filters
checker.destroy();
// Let's try fire some events
checker.fireAuditStarted();
@ -178,7 +179,9 @@ public class CheckerTest {
final String[] fileExtensions = {"java", "xml", "properties"};
checker.setFileExtensions(fileExtensions);
final int counter = checker.process(files);
assertEquals(1, counter); // comparing to 1 as there is only one legal file in input
// comparing to 1 as there is only one legal file in input
assertEquals(1, counter);
}
@SuppressWarnings("deprecation")

View File

@ -50,7 +50,8 @@ public class ScopeTest {
assertEquals("public", o.toString());
assertEquals("public", o.getName());
Scope.getInstance("unknown"); // will fail
// will fail
Scope.getInstance("unknown");
}
@Test

View File

@ -49,7 +49,8 @@ public class SeverityLevelTest {
assertEquals("info", o.toString());
assertEquals("info", o.getName());
SeverityLevel.getInstance("unknown"); // will fail
// will fail
SeverityLevel.getInstance("unknown");
}
@Test

View File

@ -97,8 +97,10 @@ public class AvoidStaticImportTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(AvoidStaticImportCheck.class);
// should NOT mask anything
checkConfig.addAttribute(
"excludes", //should NOT mask anything
"excludes",
"java.io.File.listRoots.listRoots, javax.swing.WindowConstants, javax.swing.*,"
+ "sun.net.ftpclient.FtpClient.*FtpClient, sun.net.ftpclient.FtpClientjunk, java.io.File.listRootsmorejunk");
final String[] expected = {
@ -118,8 +120,10 @@ public class AvoidStaticImportTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(AvoidStaticImportCheck.class);
// should mask com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.one
checkConfig.addAttribute(
"excludes", //should mask com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.one
"excludes",
"com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.*");
final String[] expected = {
"23: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"),

View File

@ -458,7 +458,9 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
public void testUnsupportedRule() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(CustomImportOrderCheck.class);
checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(3)###UNSUPPORTED_RULE"); //#AAA##BBBB###CCCC####DDDD
// #AAA##BBBB###CCCC####DDDD
checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(3)###UNSUPPORTED_RULE");
checkConfig.addAttribute("sortImportsInGroupAlphabetically", "true");
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;

View File

@ -83,7 +83,9 @@ public class MethodNameCheckTest
public void testMethodEqClassAllow() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MethodNameCheck.class);
checkConfig.addAttribute("allowClassName", "true"); //allow method names and class names to equal
// allow method names and class names to equal
checkConfig.addAttribute("allowClassName", "true");
final String pattern = "^[a-z][a-zA-Z0-9]*$";
@ -104,8 +106,12 @@ public class MethodNameCheckTest
public void testAccessTuning() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MethodNameCheck.class);
checkConfig.addAttribute("allowClassName", "true"); //allow method names and class names to equal
checkConfig.addAttribute("applyToPrivate", "false"); //allow method names and class names to equal
// allow method names and class names to equal
checkConfig.addAttribute("allowClassName", "true");
// allow method names and class names to equal
checkConfig.addAttribute("applyToPrivate", "false");
final String pattern = "^[a-z][a-zA-Z0-9]*$";

View File

@ -62,7 +62,10 @@ public class StaticVariableNameCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(StaticVariableNameCheck.class);
checkConfig.addAttribute("format", "^s[A-Z][a-zA-Z0-9]*$");
checkConfig.addAttribute("applyToPrivate", "false"); // allow method names and class names to equal
// allow method names and class names to equal
checkConfig.addAttribute("applyToPrivate", "false");
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSimple.java"), expected);
}