Use constant for arrays with zero length. #1555

Fixes `ZeroLengthArrayInitialization` inspection violations in test code.

Description:
>Reports on allocations of arrays with known lengths of zero. Since array lengths in Java are non-modifiable, it is almost always possible to share zero-length arrays, rather than repeatedly allocating new zero-length arrays. Such sharing may provide useful optimizations in program runtime or footprint. Note that this inspection does not report zero-length arrays allocated as static final fields, as it is assumed that those arrays are being used to implement array sharing.
This commit is contained in:
Michal Kordas 2015-08-22 00:28:08 +02:00 committed by Roman Ivanov
parent 04182c6064
commit a13ebd482c
108 changed files with 391 additions and 465 deletions

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter2filebasic.rule21filename;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -24,7 +25,7 @@ public class OuterTypeFilenameTest extends BaseCheckTestSupport{
@Test
public void outerTypeFilenameTest_1() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("OuterTypeFilename");
String filePath = builder.getFilePath("OuterTypeFilenameInput_1");
@ -36,7 +37,7 @@ public class OuterTypeFilenameTest extends BaseCheckTestSupport{
@Test
public void outerTypeFilenameTest_2() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("OuterTypeFilename");
String filePath = builder.getFilePath("OuterTypeFilenameInput_2");

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -40,7 +41,7 @@ public class NoLineWrapTest extends BaseCheckTestSupport{
@Test
public void goodLineWrapTest() throws IOException, Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("NoLineWrap");
String filePath = builder.getFilePath("NoLineWrap_Good");

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter3filestructure.rule333orderingandsoaci
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -97,8 +98,7 @@ public class CustomImportOrderTest extends BaseCheckTestSupport{
@Test
public void validTest() throws IOException, Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("CustomImportOrder");
String filePath = builder.getFilePath("CustomImportOrderValidInput");

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -46,7 +47,7 @@ public class OneTopLevelClassTest extends BaseCheckTestSupport{
@Test
public void goodTest() throws IOException, Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("OneTopLevelClass");
String filePath = builder.getFilePath("OneTopLevelClassInputGood");

View File

@ -7,6 +7,7 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -118,8 +119,7 @@ public class LeftCurlyRightCurlyTest extends BaseCheckTestSupport {
DefaultConfiguration newCheckConfig = createCheckConfig(RightCurlyCheck.class);
newCheckConfig.addAttribute("option", RightCurlyOption.SAME.toString());
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
String filePath = builder.getFilePath("RightCurlyInputSame");
Integer[] warnList = builder.getLinesWithWarn(filePath);

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -43,8 +44,7 @@ public class EmptyCatchBlockTest extends BaseCheckTestSupport
public void testNoViolations() throws Exception
{
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("EmptyCatchBlock");
String filePath = builder.getFilePath("EmptyCatchBlockNoViolationsInput");

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespac
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -90,7 +91,7 @@ public class WhitespaceAroundTest extends BaseCheckTestSupport{
@Test
public void whitespaceAroundEmptyTypesCyclesTest() throws IOException, Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("WhitespaceAround");
String filePath = builder.getFilePath("WhitespaceAroundnput_EmptyTypesAndCycles");

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter4formatting.rule4841indentation;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -24,7 +25,7 @@ public class IndentationTest extends BaseCheckTestSupport{
@Test
public void correctClassTest() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("Indentation");
String filePath = builder.getFilePath("IndentationCorrectClassInput");
@ -36,7 +37,7 @@ public class IndentationTest extends BaseCheckTestSupport{
@Test
public void correctFieldTest() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("Indentation");
String filePath = builder.getFilePath("IndentationCorrectFieldAndParameterInput");
@ -48,7 +49,7 @@ public class IndentationTest extends BaseCheckTestSupport{
@Test
public void correctForTest() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("Indentation");
String filePath = builder.getFilePath("IndentationCorrectForAndParameterInput");
@ -60,7 +61,7 @@ public class IndentationTest extends BaseCheckTestSupport{
@Test
public void correctIfTest() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("Indentation");
String filePath = builder.getFilePath("IndentationCorrectIfAndParameterInput");
@ -72,7 +73,7 @@ public class IndentationTest extends BaseCheckTestSupport{
@Test
public void correctTest() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("Indentation");
String filePath = builder.getFilePath("IndentationCorrectInput");
@ -84,7 +85,7 @@ public class IndentationTest extends BaseCheckTestSupport{
@Test
public void correctReturnTest() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("Indentation");
String filePath = builder.getFilePath("IndentationCorrectReturnAndParameterInput");
@ -96,7 +97,7 @@ public class IndentationTest extends BaseCheckTestSupport{
@Test
public void correctWhileTest() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("Indentation");
String filePath = builder.getFilePath("IndentationCorrectWhileDoWhileAndParameterInput");

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter5naming.rule521packagenames;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -30,7 +31,7 @@ public class PackageNameTest extends BaseCheckTestSupport{
public void goodPackageNameTest() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
String filePath = builder.getFilePath("PackageNameInputGood");

View File

@ -3,6 +3,7 @@ package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs;
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.BeforeClass;
import org.junit.Test;
@ -24,8 +25,7 @@ public class JavadocParagraphTest extends BaseCheckTestSupport{
@Test
public void javadocParagraphCorrectTest() throws Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
Configuration checkConfig = builder.getCheckConfig("JavadocParagraph");
String filePath = builder.getFilePath("InputCorrectJavadocParagraphCheck");

View File

@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Locale;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@ -70,8 +71,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
final BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(content);
writer.close();
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, file.getPath(), expected);
}
@ -82,9 +82,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
createCheckConfig(HiddenFieldCheck.class);
checkConfig.addAttribute("tokens", "VARIABLE_DEF, ENUM_DEF, CLASS_DEF, METHOD_DEF,"
+ "IMPORT");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
try {
verify(checkConfig, getPath("InputHiddenField.java"), expected);
fail();
@ -102,8 +100,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
public void testOnEmptyFile() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(HiddenFieldCheck.class);
final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath();
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, pathToEmptyFile, expected);
}
@ -111,8 +108,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
@Test
public void testWithCheckNotHavingTreeWalkerAsParent() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(JavadocPackageCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
try {
verify(checkConfig, temporaryFolder.newFile().getPath(), expected);
@ -175,8 +171,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
checker.addListener(new BriefLogger(stream));
final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath();
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checker, pathToEmptyFile, pathToEmptyFile, expected);
// one more time to reuse cache
@ -204,8 +199,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
checker.addListener(new BriefLogger(stream));
final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath();
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checker, pathToEmptyFile, pathToEmptyFile, expected);
@ -230,8 +224,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
public void testForInvalidCheckImplementation() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(BadJavaDocCheck.class);
final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath();
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
// nothing is expected
verify(checkConfig, pathToEmptyFile, expected);

View File

@ -26,6 +26,7 @@ import static com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheck.MSG_KE
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -37,7 +38,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport {
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(DescendantTokenCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputIllegalTokens.java"), expected);
}
@ -93,7 +94,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("limitedTokens", "LITERAL_DEFAULT");
checkConfig.addAttribute("maximumNumber", "0");
checkConfig.addAttribute("minimumDepth", "3");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputIllegalTokens.java"), expected);
}
@ -106,7 +107,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("limitedTokens", "LITERAL_DEFAULT");
checkConfig.addAttribute("maximumNumber", "0");
checkConfig.addAttribute("maximumDepth", "1");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputIllegalTokens.java"), expected);
}

View File

@ -57,8 +57,7 @@ public class FileSetCheckLifecycleTest
public void testTranslation() throws Exception {
final Configuration checkConfig =
createCheckConfig(TestFileSetCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputScopeAnonInner.java"), expected);
assertTrue("destroy() not called by Checker", TestFileSetCheck.isDestroyed());
@ -84,8 +83,7 @@ public class FileSetCheckLifecycleTest
checker.addFileSetCheck(new TestFileSetCheck());
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checker, getPath("InputScopeAnonInner.java"), expected);

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks;
import static com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck.MSG_KEY_NO_NEWLINE_EOF;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -43,7 +44,7 @@ public class NewlineAtEndOfFileCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(NewlineAtEndOfFileCheck.class);
checkConfig.addAttribute("lineSeparator", LineSeparatorOption.LF.toString());
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(
createChecker(checkConfig),
getPath("InputNewlineLfAtEndOfFile.java"),
@ -55,7 +56,7 @@ public class NewlineAtEndOfFileCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(NewlineAtEndOfFileCheck.class);
checkConfig.addAttribute("lineSeparator", LineSeparatorOption.CRLF.toString());
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(
createChecker(checkConfig),
getPath("InputNewlineCrlfAtEndOfFile.java"),
@ -67,7 +68,7 @@ public class NewlineAtEndOfFileCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(NewlineAtEndOfFileCheck.class);
checkConfig.addAttribute("lineSeparator", LineSeparatorOption.CR.toString());
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(
createChecker(checkConfig),
getPath("InputNewlineCrAtEndOfFile.java"),
@ -79,7 +80,7 @@ public class NewlineAtEndOfFileCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(NewlineAtEndOfFileCheck.class);
checkConfig.addAttribute("lineSeparator", LineSeparatorOption.LF_CR_CRLF.toString());
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(
createChecker(checkConfig),
getPath("InputNewlineCrlfAtEndOfFile.java"),

View File

@ -23,6 +23,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -47,7 +48,7 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport {
public void testGood1() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(OuterTypeFilenameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputIllegalTokens.java"), expected);
}
@ -55,7 +56,7 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport {
public void testGood2() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(OuterTypeFilenameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("Input15Extensions.java"), expected);
}
@ -75,21 +76,21 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport {
@Test
public void testNestedClass() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputOuterTypeFilenameCheck1.java"), expected);
}
@Test
public void testFinePublic() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputOuterTypeFilenameCheck2.java"), expected);
}
@Test
public void testFineDefault() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputOuterTypeFilenameCheck3.java"), expected);
}
@ -106,8 +107,7 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport {
public void testPackageAnnotation() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "package-info.java"), expected);
}

View File

@ -23,6 +23,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -52,8 +53,7 @@ public class SuppressWarningsHolderTest extends BaseCheckTestSupport {
public void testCustomAnnotation() throws Exception {
Configuration checkConfig = createCheckConfig(SuppressWarningsHolder.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/InputSuppressWarningsHolder.java").getCanonicalPath(), expected);

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.TranslationCheck.MSG_KEY;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -77,8 +78,7 @@ public class TranslationCheckTest
@Test
public void testOnePropertyFileSet() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(TranslationCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
final File[] propertyFiles = {
new File(getPath("app-dev.properties")),
};

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks;
import static com.puppycrawl.tools.checkstyle.checks.UncommentedMainCheck.MSG_KEY;
import static org.junit.Assert.assertEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -72,24 +73,21 @@ public class UncommentedMainCheckTest
@Test
public void testDeepDepth() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UncommentedMainCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputUncommentedMain2.java"), expected);
}
@Test
public void testWrongName() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UncommentedMainCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputUncommentedMain3.java"), expected);
}
@Test
public void testWrongArrayType() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UncommentedMainCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputUncommentedMain4.java"), expected);
}

View File

@ -41,8 +41,7 @@ public class AnnotationLocationCheckTest extends BaseCheckTestSupport {
@Test
public void testCorrect() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(AnnotationLocationCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation/InputCorrectAnnotationLocation.java"), expected);
}
@ -101,8 +100,7 @@ public class AnnotationLocationCheckTest extends BaseCheckTestSupport {
@Test
public void testWithoutAnnotations() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(AnnotationLocationCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation/InputAnnotationLocationCheckTest1.java"), expected);
}

View File

@ -30,6 +30,7 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import org.apache.commons.beanutils.ConversionException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -189,8 +190,7 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport {
checkConfig.addAttribute("closingParens", "ignore");
checkConfig.addAttribute("elementStyle", "ignore");
checkConfig.addAttribute("trailingArrayComma", "ALWAYS");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "AnnotationUseWithTrailingComma.java"), expected);
}
@ -221,8 +221,7 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport {
checkConfig.addAttribute("closingParens", "ignore");
checkConfig.addAttribute("elementStyle", "ignore");
checkConfig.addAttribute("trailingArrayComma", "NEVER");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "AnnotationUseNoTrailingComma.java"), expected);
}
@ -233,8 +232,7 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport {
checkConfig.addAttribute("closingParens", "ignore");
checkConfig.addAttribute("elementStyle", "ignore");
checkConfig.addAttribute("trailingArrayComma", "ignore");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "DifferentUseStyles.java"), expected);
}
@ -243,8 +241,7 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport {
public void testAnnotationsWithoutDefaultValues() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class);
checkConfig.addAttribute("closingParens", "NEVER");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "AnnotationsUseStyleParams.java"), expected);
}
@ -277,8 +274,7 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport {
checkConfig.addAttribute("closingParens", "ignore");
checkConfig.addAttribute("elementStyle", "COMPACT_NO_ARRAY");
checkConfig.addAttribute("trailingArrayComma", "ignore");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "InputAnnotationUseStyleCheckTest.java"), expected);

View File

@ -26,6 +26,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -131,8 +132,7 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport {
DefaultConfiguration checkConfig = createCheckConfig(MissingDeprecatedCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodDeprecated.java"), expected);
}

View File

@ -25,6 +25,7 @@ import static org.junit.Assert.assertEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -100,8 +101,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
checkConfig.addAttribute("javaFiveCompatibility", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromOther.java"), expected);
}
@ -131,8 +131,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
public void testBadAnnonOverrideJ5Compat() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
checkConfig.addAttribute("javaFiveCompatibility", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "BadAnnonOverride.java"), expected);
}
@ -160,8 +159,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
checkConfig.addAttribute("javaFiveCompatibility", "false");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromObject.java"), expected);
}
@ -175,8 +173,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
checkConfig.addAttribute("javaFiveCompatibility", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromObject.java"), expected);
}
@ -188,8 +185,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
@Test
public void testGoodOverrideFromOther() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromOther.java"), expected);
}
@ -203,8 +199,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
checkConfig.addAttribute("javaFiveCompatibility", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromOther.java"), expected);
}
@ -216,8 +211,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
@Test
public void testGoodAnnonOverride() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodAnnonOverride.java"), expected);
}
@ -230,8 +224,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport {
public void testGoodAnnonOverrideJ5Compat() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class);
checkConfig.addAttribute("javaFiveCompatibility", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "GoodAnnonOverride.java"), expected);
}

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.annotation;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -36,8 +37,7 @@ public class PackageAnnotationTest extends BaseCheckTestSupport {
public void testGoodPackageAnnotation() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(PackageAnnotationCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "package-info.java"), expected);
}
@ -54,7 +54,7 @@ public class PackageAnnotationTest extends BaseCheckTestSupport {
public void testAnnotationnotInPackageInfo() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(PackageAnnotationCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("annotation" + File.separator + "InputPackageAnnotationCheckTest.java"), expected);
}

View File

@ -301,8 +301,7 @@ public class LeftCurlyCheckTest extends BaseCheckTestSupport {
public void testFirstLine() throws Exception {
checkConfig.addAttribute("option", LeftCurlyOption.EOL.toString());
checkConfig.addAttribute("maxLineLength", "100");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputLeftCurlyAllInOneLine.java"), expected);
}

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck.MSG_
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -105,8 +106,7 @@ public class NeedBracesCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig = createCheckConfig(NeedBracesCheck.class);
checkConfig.addAttribute("tokens", "LITERAL_WHILE, LITERAL_DO, LITERAL_FOR");
checkConfig.addAttribute("allowSingleLineStatement", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputNeedBracesCheckTest.java"), expected);
}

View File

@ -25,6 +25,7 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_
import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_SAME;
import static org.junit.Assert.assertEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
@ -77,8 +78,7 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport {
@Test
public void testSameOmitOneLiners() throws Exception {
checkConfig.addAttribute("option", RightCurlyOption.SAME.toString());
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRightCurlySameForOneLiners.java"), expected);
}
@ -141,8 +141,7 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport {
@Test
public void testForceLineBreakBefore2() throws Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRightCurlyLineBreakBefore.java"), expected);
}
@ -150,8 +149,7 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport {
public void testNPE() throws Exception {
checkConfig.addAttribute("option", RightCurlyOption.ALONE.toString());
checkConfig.addAttribute("tokens", "CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRightCurlyEmptyAbstractMethod.java"), expected);
}

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.DefaultComesLastChec
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -48,8 +49,7 @@ public class DefaultComesLastCheckTest extends BaseCheckTestSupport {
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(DefaultComesLastCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
new File(
"src/test/resources-noncompilable/com/puppycrawl/tools/"

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding;
import static com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck.MSG_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -45,8 +46,7 @@ public class EqualsHashCodeCheckTest
public void testBooleanMethods() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(EqualsHashCodeCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputEqualsHashCodeCheck.java"), expected);
}

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCh
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -81,9 +82,7 @@ public class FinalLocalVariableCheckTest
createCheckConfig(FinalLocalVariableCheck.class);
checkConfig.addAttribute("tokens", "PARAMETER_DEF");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputFinalLocalVariableNativeMethods.java"), expected);
}
@ -93,9 +92,7 @@ public class FinalLocalVariableCheckTest
createCheckConfig(FinalLocalVariableCheck.class);
checkConfig.addAttribute("tokens", "VARIABLE_DEF, PARAMETER_DEF");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputFinalLocalVariableCheckFalsePositive.java"), expected);
}
@ -129,7 +126,7 @@ public class FinalLocalVariableCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(FinalLocalVariableCheck.class);
checkConfig.addAttribute("tokens", "PARAMETER_DEF,VARIABLE_DEF");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/"
+ "tools/checkstyle/naming/InputFinalLocalVariableNameLambda.java")
.getCanonicalPath(), expected);

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.IllegalInstantiation
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -61,7 +62,7 @@ public class IllegalInstantiationCheckTest
public void testJava8() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(IllegalInstantiationCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
new File("src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/"
+ "coding/InputIllegalInstantiationCheckTest2.java").getCanonicalPath(),
@ -108,7 +109,7 @@ public class IllegalInstantiationCheckTest
checkConfig.addAttribute(
"classes",
"jjva.lang.Boolean,java.lang*Boolean");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
new File("src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/"
+ "coding/InputIllegalInstantiationCheckLang.java").getCanonicalPath(),

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -61,9 +62,7 @@ public class InnerAssignmentCheckTest
public void testLambdexpression() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(InnerAssignmentCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/coding/"
+ "InputInnerAssignmentLambdaExpressions.java").getCanonicalPath(), expected);

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding;
import static com.puppycrawl.tools.checkstyle.checks.coding.ModifiedControlVariableCheck.MSG_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -54,8 +55,7 @@ public class ModifiedControlVariableCheckTest
createCheckConfig(ModifiedControlVariableCheck.class);
checkConfig.addAttribute("skipEnhancedForLoopVariable", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputModifiedControlVariableEnhancedForLoopVariable.java"), expected);
}

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding;
import static com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck.MSG_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -72,8 +73,7 @@ public class NestedForDepthCheckTest extends BaseCheckTestSupport {
createCheckConfig(NestedForDepthCheck.class);
checkConfig.addAttribute("max", "4");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputNestedForDepth.java"),
expected);

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding;
import static com.puppycrawl.tools.checkstyle.checks.coding.NestedIfDepthCheck.MSG_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -48,8 +49,7 @@ public class NestedIfDepthCheckTest extends BaseCheckTestSupport {
createCheckConfig(NestedIfDepthCheck.class);
checkConfig.addAttribute("max", "2");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputNestedIfDepth.java"), expected);
}

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding;
import static com.puppycrawl.tools.checkstyle.checks.coding.NoFinalizerCheck.MSG_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -49,8 +50,7 @@ public class NoFinalizerCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(NoFinalizerCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("coding/InputFallThrough.java"), expected);
}
}

View File

@ -24,6 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.MSG
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -80,7 +81,7 @@ public class RequireThisCheckTest extends BaseCheckTestSupport {
public void testGenerics() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(RequireThisCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("Input15Extensions.java"), expected);
}

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.ReturnCountCheck.MSG
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -100,8 +101,7 @@ public class ReturnCountCheckTest extends BaseCheckTestSupport {
public void testWithReturnOnlyAsTokens() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(ReturnCountCheck.class);
checkConfig.addAttribute("tokens", "LITERAL_RETURN");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/coding/InputReturnCountLambda.java").getCanonicalPath(), expected);
}

View File

@ -28,6 +28,7 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.UnnecessaryParenthes
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -101,7 +102,7 @@ public class UnnecessaryParenthesesCheckTest extends BaseCheckTestSupport {
@Test
public void test15Extensions() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnnecessaryParenthesesCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("Input15Extensions.java"), expected);
}

View File

@ -24,6 +24,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -65,8 +66,7 @@ public class HideUtilityClassConstructorCheckTest
public void testUtilClassPrivateCtor() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(HideUtilityClassConstructorCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "UtilityClassConstructorPrivate.java"), expected);
}
@ -75,8 +75,7 @@ public class HideUtilityClassConstructorCheckTest
public void testNonUtilClass() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(HideUtilityClassConstructorCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputDesignForExtension.java"), expected);
}
@ -84,8 +83,7 @@ public class HideUtilityClassConstructorCheckTest
public void testDerivedNonUtilClass() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(HideUtilityClassConstructorCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "InputNonUtilityClass.java"), expected);
}
@ -93,8 +91,7 @@ public class HideUtilityClassConstructorCheckTest
public void testOnlyNonstaticFieldNonUtilClass() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(HideUtilityClassConstructorCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "InputRegression1762702.java"), expected);
}
@ -102,8 +99,7 @@ public class HideUtilityClassConstructorCheckTest
public void testEmptyAbstractClass() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(HideUtilityClassConstructorCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "HideUtilityClassContructor3041574_1.java"), expected);
}
@ -111,8 +107,7 @@ public class HideUtilityClassConstructorCheckTest
public void testEmptyClassWithOnlyPrivateFields() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(HideUtilityClassConstructorCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "HideUtilityClassContructor3041574_2.java"), expected);
}
@ -120,8 +115,7 @@ public class HideUtilityClassConstructorCheckTest
public void testClassWithStaticInnerClass() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(HideUtilityClassConstructorCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "HideUtilityClassContructor3041574_3.java"), expected);
}
@ -129,8 +123,7 @@ public class HideUtilityClassConstructorCheckTest
public void testProtectedCtor() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(HideUtilityClassConstructorCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "HideUtilityClassConstructor.java"), expected);
}

View File

@ -51,7 +51,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport {
public void testFileWithOneTopLevelClass() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(OneTopLevelClassCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "InputOneTopLevelClass.java"), expected);
}
@ -59,7 +59,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport {
public void testFileWithOneTopLevelInterface() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(OneTopLevelClassCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "InputOneTopLevelInterface.java"), expected);
}
@ -67,7 +67,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport {
public void testFileWithOneTopLevelEnum() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(OneTopLevelClassCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "InputOneTopLevelEnum.java"), expected);
}
@ -132,8 +132,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport {
@Test
public void testPackageInfoWithNoTypesDeclared() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(OneTopLevelClassCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("design" + File.separator + "package-info.java"), expected);
}
}

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.design;
import static com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck.MSG_KEY;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import antlr.CommonHiddenStreamToken;
@ -169,8 +170,7 @@ public class VisibilityModifierCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(VisibilityModifierCheck.class);
checkConfig.addAttribute("immutableClassCanonicalNames", "java.util.Arrays");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputImmutableStarImport.java"), expected);
}
@ -180,8 +180,7 @@ public class VisibilityModifierCheckTest
createCheckConfig(VisibilityModifierCheck.class);
checkConfig.addAttribute("immutableClassCanonicalNames",
"com.google.common.collect.ImmutableSet");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputImmutableStarImport2.java"), expected);
}

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck.MSG_MISM
import static com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck.MSG_MISSING;
import static org.junit.Assert.fail;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport;
@ -49,8 +50,7 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport {
createCheckConfig(HeaderCheck.class);
try {
createChecker(checkConfig);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRegexpHeader1.java"), expected);
}
catch (CheckstyleException ex) {
@ -121,8 +121,7 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport {
createCheckConfig(HeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("configs/java.header"));
checkConfig.addAttribute("ignoreLines", "2");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("configs/java2.header"), expected);
}

View File

@ -27,6 +27,7 @@ import java.io.File;
import java.net.URI;
import org.apache.commons.beanutils.ConversionException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport;
@ -96,8 +97,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class);
try {
createChecker(checkConfig);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRegexpHeader1.java"), expected);
}
catch (CheckstyleException ex) {
@ -172,8 +172,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
final DefaultConfiguration checkConfig =
createCheckConfig(RegexpHeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("regexp.header1"));
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputScopeAnonInner.java"), expected);
}
@ -183,8 +182,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
createCheckConfig(RegexpHeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("regexp.header2"));
checkConfig.addAttribute("multiLines", "3, 6");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRegexpHeader1.java"), expected);
}
@ -194,8 +192,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
createCheckConfig(RegexpHeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("regexp.header2"));
checkConfig.addAttribute("multiLines", "3, 6");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRegexpHeader2.java"), expected);
}
@ -205,8 +202,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
createCheckConfig(RegexpHeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("regexp.header2"));
checkConfig.addAttribute("multiLines", "3, 7");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRegexpHeader1.java"), expected);
}
@ -216,8 +212,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
createCheckConfig(RegexpHeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("regexp.header2"));
checkConfig.addAttribute("multiLines", "3, 5, 6, 7");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRegexpHeader3.java"), expected);
}
@ -239,8 +234,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
createCheckConfig(RegexpHeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("regexp2.header4"));
checkConfig.addAttribute("multiLines", "8974382");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRegexpHeader6.java"), expected);
}
@ -250,8 +244,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
createCheckConfig(RegexpHeaderCheck.class);
checkConfig.addAttribute("headerFile", getPath("regexp.header2"));
checkConfig.addAttribute("multiLines", "3, 6");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputRegexpSmallHeader.java"), expected);
}

View File

@ -31,6 +31,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import java.lang.reflect.Method;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -221,7 +222,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("sortImportsInGroupAlphabetically", "true");
checkConfig.addAttribute("customImportOrderRules",
"STATIC###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputCustomImportOrderNoValid.java"), expected);
@ -280,9 +281,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("separateLineBetweenGroups", "true");
checkConfig.addAttribute("customImportOrderRules",
"SAME_PACKAGE(3)###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###STATIC");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputCustomImportOrderThirdPartyPackage.java"), expected);
@ -420,7 +419,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("separateLineBetweenGroups", "false");
checkConfig.addAttribute("customImportOrderRules",
"SAME_PACKAGE(5)");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/imports/"
@ -435,7 +434,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("separateLineBetweenGroups", "false");
checkConfig.addAttribute("customImportOrderRules",
"SAME_PACKAGE(-1)");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputCustomImportOrder.java"), expected);
@ -449,7 +448,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("separateLineBetweenGroups", "false");
checkConfig.addAttribute("customImportOrderRules",
"SAME_PACKAGE(0)");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputCustomImportOrder.java"), expected);
@ -461,7 +460,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
createCheckConfig(CustomImportOrderCheck.class);
checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(3)###UNSUPPORTED_RULE"); //#AAA##BBBB###CCCC####DDDD
checkConfig.addAttribute("sortImportsInGroupAlphabetically", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputCustomImportOrder.java"), expected);
@ -473,7 +472,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
createCheckConfig(CustomImportOrderCheck.class);
checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(INT_IS_REQUIRED_HERE)");
checkConfig.addAttribute("sortImportsInGroupAlphabetically", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputCustomImportOrder.java"), expected);
@ -484,7 +483,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig =
createCheckConfig(CustomImportOrderCheck.class);
checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(3)");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources/com/puppycrawl/tools/"
+ "checkstyle/imports/"

View File

@ -27,6 +27,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -104,7 +105,7 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
public void testUnknown() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
checkConfig.addAttribute("file", "unknown-file");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
try {
verify(checkConfig, getPath("imports" + File.separator
+ "InputImportControl.java"), expected);
@ -120,7 +121,7 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
checkConfig.addAttribute("file",
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_broken.xml");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
try {
verify(checkConfig, getPath("imports" + File.separator
+ "InputImportControl.java"), expected);
@ -176,7 +177,7 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
checkConfig.addAttribute("file",
"aaa://src");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputImportControl.java"), expected);
}

View File

@ -25,6 +25,7 @@ import static org.junit.Assert.assertEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.internal.util.reflection.Whitebox;
@ -114,8 +115,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
public void testCaseInsensitive() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class);
checkConfig.addAttribute("caseSensitive", "false");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrderCaseInsensitive.java"), expected);
}
@ -125,7 +125,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig =
createCheckConfig(ImportOrderCheck.class);
checkConfig.addAttribute("option", "invalid_option");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_Top.java"), expected);
}
@ -237,7 +237,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
<property name="separated" value="true"/>
*/
checkConfig.addAttribute("groups", "java,javax,org");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_WildcardUnspecified.java"), expected);
}
@ -246,7 +246,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
public void testNoFailureForRedundantImports() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(ImportOrderCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_NoFailureForRedundantImports.java"), expected);
}
@ -257,7 +257,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("option", "top");
checkConfig.addAttribute("groups", "org, java");
checkConfig.addAttribute("sortStaticImportsAlphabetically", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrderStaticGroupOrder.java"), expected);
}
@ -280,7 +280,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("option", "bottom");
checkConfig.addAttribute("groups", "org, java");
checkConfig.addAttribute("sortStaticImportsAlphabetically", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrderStaticGroupOrderBottom.java"), expected);
}
@ -358,7 +358,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("option", "bottom");
checkConfig.addAttribute("groups", "org, java");
checkConfig.addAttribute("sortStaticImportsAlphabetically", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputImportOrderStaticOnDemandGroupOrderBottom.java"), expected);
}
@ -382,7 +382,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
public void testGroupWithSlashes() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class);
checkConfig.addAttribute("groups", "/^javax");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder.java"), expected);
}
@ -391,7 +391,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
public void testGroupWithDot() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class);
checkConfig.addAttribute("groups", "java.awt.");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_NoFailureForRedundantImports.java"), expected);
}
@ -400,7 +400,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
public void testMultiplePatternMatches() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class);
checkConfig.addAttribute("groups", "/java/,/rga/,/myO/,/org/,/organ./");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/imports/"
@ -462,7 +462,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("separated", "true");
checkConfig.addAttribute("option", "top");
checkConfig.addAttribute("sortStaticImportsAlphabetically", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_EclipseDefaultPositive.java"), expected);
}

View File

@ -24,6 +24,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -88,7 +89,7 @@ public class UnusedImportsCheckTest extends BaseCheckTestSupport {
@Test
public void testAnnotations() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "package-info.java"), expected);
}
@ -96,7 +97,7 @@ public class UnusedImportsCheckTest extends BaseCheckTestSupport {
@Test
public void testBug() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("imports" + File.separator
+ "InputImportBug.java"), expected);
}

View File

@ -24,6 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndenta
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -60,8 +61,7 @@ public class CommentsIndentationCheckTest extends BaseCheckTestSupport {
public void testNpe() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(CommentsIndentationCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("comments" + File.separator
+ "InputCommentsIndentationTestNpe.java"), expected);
}

View File

@ -35,6 +35,7 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -238,7 +239,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputZeroCaseLevel.java"), expected);
}
@ -318,8 +319,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/FromGuava2.java"), expected);
}
@ -335,7 +335,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/FromGuava.java"), expected);
}
@ -351,7 +351,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/IndentationCorrectIfAndParameterInput.java"), expected);
}
@ -367,7 +367,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputAnonymousClasses.java"), expected);
}
@ -383,8 +383,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputArrays.java"), expected);
}
@ -400,8 +399,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputLabels.java"), expected);
}
@ -417,8 +415,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputClassesMethods.java"), expected);
}
@ -498,8 +495,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputValidLabelIndent.java"), expected);
}
@ -536,8 +532,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidDotIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -680,8 +675,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidSwitchIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -699,8 +693,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidArrayInitDefaultIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -718,7 +711,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidArrayInitIndent.java");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -788,8 +781,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidTryIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -1202,8 +1194,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidForIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -1221,8 +1212,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidDoWhileIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -1240,8 +1230,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidBlockIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -1259,8 +1248,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidWhileIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -1299,8 +1287,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidInterfaceDefIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -1319,8 +1306,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String fname = getPath("indentation/InputValidCommaIndent.java");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, fname, expected);
}
@ -1372,8 +1358,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "8");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InvalidInputThrowsIndent.java"), expected);
}
@ -1457,8 +1442,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputValidAssignIndent.java"), expected);
}
@ -1474,7 +1458,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/Input15Extensions.java"), expected);
}
@ -1490,7 +1474,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "4");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "4");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputValidTryResourcesIndent.java"),
expected);
}
@ -1507,7 +1491,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "8");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "8");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputSwitchCustom.java"),
expected);
}
@ -1523,8 +1507,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "8");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "8");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputSynchronizedStatement.java"), expected);
}
@ -1539,8 +1522,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("lineWrappingIndentation", "8");
checkConfig.addAttribute("tabWidth", "4");
checkConfig.addAttribute("throwsIndent", "8");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputSynchronizedMethod.java"), expected);
}
@ -1569,8 +1551,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
public void testAnnotationDefinition() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class);
checkConfig.addAttribute("tabWidth", "4");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verifyWarns(checkConfig, getPath("indentation/InputAnnotationDefinition.java"), expected);
}

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.indentation;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -33,9 +34,7 @@ public class NewHandlerTest extends BaseCheckTestSupport {
@Test
public void testInvalidLabel() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/indentation/NewHandlerTestInput.java").getCanonicalPath(), expected);
}

View File

@ -24,6 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocChec
import static com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck.PARSE_ERROR_MESSAGE_KEY;
import static com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck.UNRECOGNIZED_ANTLR_ERROR_MESSAGE_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -76,8 +77,7 @@ public class AbstractJavadocCheckTest extends BaseCheckTestSupport {
checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader());
checker.configure(checkerConfig);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checker, getPath("javadoc/InputCorrectJavaDocParagraphCheck.java"), expected);
}

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc;
import static com.puppycrawl.tools.checkstyle.checks.javadoc.AtclauseOrderCheck.MSG_KEY;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -47,7 +48,7 @@ public class AtclauseOrderCheckTest extends BaseCheckTestSupport {
@Test
public void testCorrect() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(AtclauseOrderCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("javadoc/InputCorrectAtClauseOrderCheck.java"), expected);
}

View File

@ -31,6 +31,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
@ -99,7 +100,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
DefaultConfiguration config = createCheckConfig(JavadocMethodCheck.class);
config.addAttribute("allowedAnnotations", "Override,ThisIsOk, \t\n\t ThisIsOkToo");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(config, getPath("javadoc/AllowedAnnotations.java"), expected);
}
@ -198,7 +199,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
@Test
public void testNoJavadoc() throws Exception {
checkConfig.addAttribute("scope", Scope.NOTHING.getName());
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputPublicOnly.java"), expected);
}
@ -228,7 +229,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
@Test
public void testScopeAnonInnerPrivate() throws Exception {
checkConfig.addAttribute("scope", Scope.PRIVATE.getName());
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputScopeAnonInner.java"), expected);
}
@ -245,7 +246,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
@Test
public void testScopeAnonInnerWithResolver() throws Exception {
checkConfig.addAttribute("allowUndeclaredRTE", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputScopeAnonInner.java"), expected);
}
@ -382,7 +383,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
@Test
public void testAllowMissingJavadoc() throws Exception {
checkConfig.addAttribute("allowMissingJavadoc", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("javadoc" + File.separator
+ "InputNoJavadoc.java"), expected);
}
@ -392,7 +393,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("allowMissingParamTags", "true");
checkConfig.addAttribute("allowMissingThrowsTags", "true");
checkConfig.addAttribute("allowMissingReturnTag", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("javadoc" + File.separator
+ "InputMissingJavadocTags.java"), expected);
}
@ -471,13 +472,13 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
@Test
public void test_1168408_1() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("checks/javadoc/Input_01.java"), expected);
}
@Test
public void test_1168408_2() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("checks/javadoc/Input_02.java"), expected);
}
@ -485,7 +486,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
public void test_1168408_3() throws Exception {
checkConfig.addAttribute("allowThrowsTagsForSubclasses", "true");
checkConfig.addAttribute("allowUndeclaredRTE", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("checks/javadoc/Input_03.java"), expected);
}
@ -536,7 +537,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport {
public void test_1379666() throws Exception {
checkConfig.addAttribute("allowThrowsTagsForSubclasses", "true");
checkConfig.addAttribute("allowUndeclaredRTE", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("checks/javadoc/Input_1379666.java"), expected);
}

View File

@ -24,6 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -108,7 +109,7 @@ public class JavadocPackageCheckTest
public void testHtmlAllowed() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(JavadocPackageCheck.class);
checkConfig.addAttribute("allowLegacy", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(createChecker(checkConfig),
getPath("javadoc/pkghtml/Ignored.java"),
getPath("javadoc/pkghtml/package-info.java"), expected);
@ -117,7 +118,7 @@ public class JavadocPackageCheckTest
@Test
public void testAnnotation() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(JavadocPackageCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(createChecker(checkConfig),
getPath("javadoc/pkginfo/annotation/package-info.java"),
getPath("javadoc/pkginfo/annotation/package-info.java"), expected);

View File

@ -25,6 +25,7 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphChe
import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck.MSG_TAG_AFTER;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
@ -50,7 +51,7 @@ public class JavadocParagraphCheckTest extends BaseCheckTestSupport {
@Test
public void testCorrect() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("javadoc/InputCorrectJavaDocParagraphCheck.java"), expected);
}

View File

@ -29,6 +29,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -190,8 +191,7 @@ public class JavadocStyleCheckTest
final DefaultConfiguration checkConfig = createCheckConfig(JavadocStyleCheck.class);
checkConfig.addAttribute("checkFirstSentence", "false");
checkConfig.addAttribute("checkHtml", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputJavadocStyleCheckHtmlComment.java"), expected);
}
@ -358,8 +358,7 @@ public class JavadocStyleCheckTest
public void packageInfoAnnotation() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(JavadocStyleCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
String basePath = "javadoc" + File.separator
+ "pkginfo" + File.separator + "annotation" + File.separator;
@ -389,7 +388,7 @@ public class JavadocStyleCheckTest
public void packageInfoValid() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(JavadocStyleCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
String basePath = "javadoc" + File.separator
+ "pkginfo" + File.separator + "valid" + File.separator;

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc;
import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagContinuationIndentationCheck.MSG_KEY;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -43,8 +44,7 @@ public class JavadocTagContinuationIndentationCheckTest
public void testFP() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(JavadocTagContinuationIndentationCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("javadoc/GuavaFP.java"), expected);
}

View File

@ -28,6 +28,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -366,8 +367,7 @@ public class JavadocTypeCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig =
createCheckConfig(JavadocTypeCheck.class);
checkConfig.addAttribute("allowUnknownTags", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
getPath("javadoc" + File.separator + "InputBadTag.java"),
expected);

View File

@ -24,6 +24,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -90,8 +91,7 @@ public class JavadocVariableCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(JavadocVariableCheck.class);
checkConfig.addAttribute("scope", Scope.PUBLIC.getName());
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputInner.java"), expected);
}

View File

@ -24,6 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.fail;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
@ -50,8 +51,7 @@ public class SummaryJavadocCheckTest extends BaseCheckTestSupport {
public void testCorrect() throws Exception {
checkConfig.addAttribute("forbiddenSummaryFragments",
"^@return the *|^This method returns *|^A [{]@code [a-zA-Z0-9]+[}]( is a )");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("javadoc/InputCorrectSummaryJavaDocCheck.java"), expected);
}
@ -86,8 +86,7 @@ public class SummaryJavadocCheckTest extends BaseCheckTestSupport {
@Test
public void testNoPeriod() throws Exception {
checkConfig.addAttribute("period", "");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("javadoc/InputSummaryJavadocCheckNoPeriod.java"), expected);
}

View File

@ -32,6 +32,7 @@ import java.io.LineNumberReader;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
@ -53,8 +54,7 @@ public class WriteTagCheckTest extends BaseCheckTestSupport {
@Test
public void testDefaultSettings() throws Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputWriteTag.java"), expected);
}
@ -148,8 +148,7 @@ public class WriteTagCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("tag", "@todo2");
checkConfig.addAttribute("tagFormat", "\\S");
checkConfig.addAttribute("severity", "ignore");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputWriteTag.java"), expected);
}
@ -158,8 +157,7 @@ public class WriteTagCheckTest extends BaseCheckTestSupport {
throws Exception {
checkConfig.addAttribute("tag", "@author");
checkConfig.addAttribute("tagFormat", "0*");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputWriteTag.java"), expected);
}

View File

@ -25,6 +25,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -62,8 +63,7 @@ public class ModifierOrderCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(ModifierOrderCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools"
+ "/checkstyle/InputModifier2.java").getCanonicalPath(), expected);
}

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierC
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -60,8 +61,7 @@ public class RedundantModifierTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(RedundantModifierCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/InputStaticModifierInInterface.java").getCanonicalPath(),

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming;
import static com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck.MSG_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -298,8 +299,7 @@ public class AbbreviationAsWordInNameCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("ignoreFinal", "false");
checkConfig.addAttribute("allowedAbbreviations", null);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("naming/AbstractMultisetSetCountTester.java"), expected);
}

View File

@ -25,6 +25,7 @@ import static org.junit.Assert.fail;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -110,8 +111,7 @@ public class ConstantNameCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(ConstantNameCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("naming" + File.separator + "InputConstantNames.java"), expected);
}
@ -140,8 +140,7 @@ public class ConstantNameCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(ConstantNameCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/InputStaticModifierInInterface.java").getCanonicalPath(),

View File

@ -73,7 +73,7 @@ public class LocalFinalVariableNameCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(LocalFinalVariableNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputInner.java"), expected);
}

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming;
import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -50,7 +51,7 @@ public class LocalVariableNameCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(LocalVariableNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputInner.java"), expected);
}

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS
import static com.puppycrawl.tools.checkstyle.checks.naming.MethodNameCheck.MSG_KEY;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -125,8 +126,7 @@ public class MethodNameCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(MethodNameCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("naming/InputMethodNameExtra.java"), expected);
}

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming;
import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -58,8 +59,7 @@ public class PackageNameCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(PackageNameCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSimple.java"), expected);
}

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming;
import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -44,8 +45,7 @@ public class ParameterNameCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(ParameterNameCheck.class);
checkConfig.addAttribute("format", "^NO_WAY_MATEY$");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputLeftCurlyOther.java"), expected);
}
@ -71,8 +71,7 @@ public class ParameterNameCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(ParameterNameCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSimple.java"), expected);
}

View File

@ -24,6 +24,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -62,8 +63,7 @@ public class StaticVariableNameCheckTest
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
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSimple.java"), expected);
}
@ -72,8 +72,7 @@ public class StaticVariableNameCheckTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(StaticVariableNameCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
new File("src/test/resources/com/puppycrawl/tools/"
+ "checkstyle/naming/InputStaticVariableName.java").getCanonicalPath(),

View File

@ -25,6 +25,7 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.TypeNameCheck.DEFAUL
import java.io.File;
import java.io.IOException;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -48,8 +49,7 @@ public class TypeNameCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(TypeNameCheck.class);
checkConfig.addAttribute("format", "^inputHe");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, inputFilename, expected);
}

View File

@ -44,8 +44,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig =
createCheckConfig(RegexpCheck.class);
checkConfig.addAttribute("format", required);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
@ -68,8 +67,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
createCheckConfig(RegexpCheck.class);
checkConfig.addAttribute("format", required);
checkConfig.addAttribute("duplicateLimit", "0");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
@ -79,8 +77,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig = createCheckConfig(RegexpCheck.class);
checkConfig.addAttribute("format", required);
checkConfig.addAttribute("duplicateLimit", "-1");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
@ -104,8 +101,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
createCheckConfig(RegexpCheck.class);
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("illegalPattern", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
@ -217,8 +213,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("illegalPattern", "true");
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -246,8 +241,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("illegalPattern", "true");
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -274,8 +268,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("illegalPattern", "true");
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -287,8 +280,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("illegalPattern", "true");
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -300,8 +292,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("illegalPattern", "true");
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -342,16 +333,14 @@ public class RegexpCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("illegalPattern", "true");
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@Test
public void testOnFileStartingWithEmptyLine() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(RegexpCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputStartingWithEmptyLine.java"), expected);
}
}

View File

@ -26,6 +26,7 @@ import static com.puppycrawl.tools.checkstyle.checks.regexp.MultilineDetector.ST
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@ -85,7 +86,7 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport {
final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\(";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreCase", "false");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
@ -119,8 +120,7 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport {
@Test
public void testDefaultConfiguration() throws Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
@ -193,8 +193,7 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport {
final String illegal = "^import";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("maximum", "5000");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.regexp;
import static com.puppycrawl.tools.checkstyle.checks.regexp.MultilineDetector.REGEXP_EXCEEDED;
import static com.puppycrawl.tools.checkstyle.checks.regexp.MultilineDetector.REGEXP_MINIMUM;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
@ -77,7 +78,7 @@ public class RegexpSinglelineCheckTest extends BaseFileSetCheckTestSupport {
final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\(";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreCase", "false");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}

View File

@ -83,7 +83,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\(";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreCase", "false");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
@ -93,8 +93,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
final String illegal = "don't use trailing comments";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -116,8 +115,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
final String illegal = "c-style 1";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -138,8 +136,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
final String illegal = "c-style 2";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -148,8 +145,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
final String illegal = "Let's check multi-line comments";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -158,8 +154,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
final String illegal = "long ms /";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -191,8 +186,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
final String illegal = "long ms ";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -202,8 +196,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
final String illegal = "\\s+$";
checkConfig.addAttribute("format", illegal);
checkConfig.addAttribute("ignoreComments", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputTrailingComment.java"), expected);
}
@ -213,8 +206,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("format", required);
checkConfig.addAttribute("minimum", "1");
checkConfig.addAttribute("maximum", "1000");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}
@ -224,8 +216,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport {
checkConfig.addAttribute("format", required);
checkConfig.addAttribute("minimum", "1");
checkConfig.addAttribute("maximum", "1000");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSemantic.java"), expected);
}

View File

@ -23,6 +23,7 @@ import static com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck.MSG_K
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -58,8 +59,7 @@ public class FileLengthCheckTest
DefaultConfiguration checkConfig =
createCheckConfig(FileLengthCheck.class);
checkConfig.addAttribute("max", "2000");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(createChecker(checkConfig),
getPath("InputSimple.java"),
getPath("InputSimple.java"), expected);
@ -84,7 +84,7 @@ public class FileLengthCheckTest
DefaultConfiguration checkConfig =
createCheckConfig(FileLengthCheck.class);
checkConfig.addAttribute("fileExtensions", "txt");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(createChecker(checkConfig),
getPath("InputSimple.java"),

View File

@ -26,6 +26,7 @@ import static com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.MSG_
import static com.puppycrawl.tools.checkstyle.checks.sizes.MethodCountCheck.MSG_PUBLIC_METHODS;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -62,8 +63,7 @@ public class MethodCountCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig =
createCheckConfig(MethodCountCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("sizes/MethodCountCheckInput.java"), expected);
}

View File

@ -67,8 +67,7 @@ public class MethodLengthCheckTest extends BaseCheckTestSupport {
createCheckConfig(MethodLengthCheck.class);
checkConfig.addAttribute("max", "19");
checkConfig.addAttribute("countEmpty", "false");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSimple.java"), expected);
}
@ -76,8 +75,7 @@ public class MethodLengthCheckTest extends BaseCheckTestSupport {
public void testAbstract() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MethodLengthCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputModifier.java"), expected);
}
}

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.sizes;
import static com.puppycrawl.tools.checkstyle.checks.sizes.OuterTypeNumberCheck.MSG_KEY;
import static org.junit.Assert.assertArrayEquals;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -71,8 +72,7 @@ public class OuterTypeNumberCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig =
createCheckConfig(OuterTypeNumberCheck.class);
checkConfig.addAttribute("max", "30");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputSimple.java"), expected);
}
@ -81,8 +81,7 @@ public class OuterTypeNumberCheckTest extends BaseCheckTestSupport {
final DefaultConfiguration checkConfig =
createCheckConfig(OuterTypeNumberCheck.class);
checkConfig.addAttribute("max", "1");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("OuterTypeNumberCheckInput.java"), expected);
}
}

View File

@ -95,9 +95,7 @@ public class EmptyLineSeparatorCheckTest
public void testFormerArrayIndexOutOfBounds() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(EmptyLineSeparatorCheck.class);
checkConfig.addAttribute("allowMultipleEmptyLines", "false");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/InputEmptyLineSeparatorFormerException.java"), expected);
}
@ -106,9 +104,7 @@ public class EmptyLineSeparatorCheckTest
DefaultConfiguration checkConfig = createCheckConfig(EmptyLineSeparatorCheck.class);
checkConfig.addAttribute("allowMultipleEmptyLines", "false");
checkConfig.addAttribute("allowNoEmptyLineBetweenFields", "true");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/InputEmptyLineSeparatorMultipleFieldsInClass.java"), expected);
}
@ -145,9 +141,7 @@ public class EmptyLineSeparatorCheckTest
public void testPrePreviousLineEmpiness() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(EmptyLineSeparatorCheck.class);
checkConfig.addAttribute("allowMultipleEmptyLines", "false");
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/InputPrePreviousLineEmptiness.java"), expected);
}
}

View File

@ -28,6 +28,7 @@ import static org.junit.Assert.assertArrayEquals;
import java.io.File;
import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
@ -100,22 +101,20 @@ public class GenericWhitespaceCheckTest
@Test
public void testGh47() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/Gh47.java"), expected);
}
@Test
public void testInnerClass() throws Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/"
+ "InputGenericWhitespaceInnerClassCheck.java"), expected);
}
@Test
public void testMethodReferences() throws Exception {
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/grammars/java8/"
+ "InputMethodReferencesTest3.java").getCanonicalPath(), expected);

View File

@ -118,8 +118,7 @@ public class MethodParamPadCheckTest
@Test
public void test1322879() throws Exception {
checkConfig.addAttribute("option", PadOption.SPACE.toString());
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/InputWhitespaceAround.java"),
expected);
}

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace;
import static com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck.MSG_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -31,7 +32,7 @@ public class NoLineWrapCheckTest
@Test
public void testCaseWithoutLineWrapping() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(NoLineWrapCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/NoLineWrapGoodInput.java"), expected);
}

View File

@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace;
import static com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheck.MSG_KEY;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Before;
import org.junit.Test;
@ -104,9 +105,7 @@ public class NoWhitespaceAfterCheckTest
@Test
public void testNpe() throws Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/InputNoWhiteSpaceAfterCheckFormerNpe.java"),
expected);
}

View File

@ -24,6 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPad
import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck.WS_NOT_PRECEDED;
import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck.WS_PRECEDED;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -136,8 +137,7 @@ public class ParenPadCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(ParenPadCheck.class);
checkConfig.addAttribute("option", PadOption.SPACE.toString());
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/ParenPadWithSpace.java"),
expected);
}

View File

@ -24,6 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPad
import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck.WS_NOT_PRECEDED;
import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck.WS_PRECEDED;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -69,8 +70,7 @@ public class TypecastParenPadCheckTest
final DefaultConfiguration checkConfig =
createCheckConfig(TypecastParenPadCheck.class);
checkConfig.addAttribute("option", PadOption.SPACE.toString());
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/InputWhitespaceAround.java"),
expected);
}

View File

@ -93,8 +93,7 @@ public class WhitespaceAfterCheckTest
@Test
public void test1322879() throws Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/InputWhitespaceAround.java"),
expected);
}

View File

@ -144,8 +144,7 @@ public class WhitespaceAroundTest
@Test
public void test1322879And1649038() throws Exception {
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("whitespace/InputWhitespaceAround.java"),
expected);
}
@ -217,7 +216,7 @@ public class WhitespaceAroundTest
@Test
public void allowEmptyMethods() throws Exception {
checkConfig.addAttribute("allowEmptyMethods", "true");
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig,
getPath("whitespace/InputWhitespaceAround.java"),
expected);

View File

@ -23,6 +23,7 @@ import java.io.File;
import java.util.Arrays;
import java.util.Set;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -41,7 +42,7 @@ public class AllBlockCommentsTest extends BaseCheckTestSupport {
@Test
public void testAllBlockComments() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(BlockCommentListenerCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("comments" + File.separator
+ "InputFullOfBlockComments.java"), expected);
Assert.assertTrue(ALL_COMMENTS.isEmpty());

View File

@ -22,6 +22,7 @@ package com.puppycrawl.tools.checkstyle.comments;
import java.io.File;
import java.util.Set;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -40,7 +41,7 @@ public class AllSinglelineCommentsTest extends BaseCheckTestSupport {
@Test
public void testAllBlockComments() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(SinglelineCommentListenerCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("comments" + File.separator
+ "InputFullOfSinglelineComments.java"), expected);
Assert.assertTrue(ALL_COMMENTS.isEmpty());

View File

@ -48,6 +48,7 @@ import static com.puppycrawl.tools.checkstyle.api.TokenTypes.TYPE;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Assert;
import org.junit.Test;
@ -599,7 +600,7 @@ public class CommentsTest extends BaseCheckTestSupport {
public void testCompareExpectedTreeWithInput_1() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(CompareTreesWithComments.class);
CompareTreesWithComments.expectedTree = buildInput1();
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("comments" + File.separator
+ "InputCommentsTest_1.java"), expected);
}
@ -608,7 +609,7 @@ public class CommentsTest extends BaseCheckTestSupport {
public void testCompareExpectedTreeWithInput_2() throws Exception {
DefaultConfiguration checkConfig = createCheckConfig(CompareTreesWithComments.class);
CompareTreesWithComments.expectedTree = buildInput2();
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("comments" + File.separator
+ "InputCommentsTest_2.java"), expected);
}

View File

@ -19,6 +19,7 @@
package com.puppycrawl.tools.checkstyle.grammars;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -36,7 +37,7 @@ public class EmbeddedNullCharTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("grammars/InputEmbeddedNullChar.java"), expected);
}
}

View File

@ -2,6 +2,7 @@ package com.puppycrawl.tools.checkstyle.grammars;
import java.io.File;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assume;
import org.junit.Test;
@ -31,9 +32,7 @@ public class GeneratedJava14LexerTest
public void testSemicolonBetweenImports() throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {
};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
+ "checkstyle/grammars/SemicolonBetweenImports.java").getCanonicalPath(), expected);
}

View File

@ -19,6 +19,7 @@
package com.puppycrawl.tools.checkstyle.grammars;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -36,7 +37,7 @@ public class HexFloatsTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("grammars/InputHexFloat.java"), expected);
}
}

View File

@ -19,6 +19,7 @@
package com.puppycrawl.tools.checkstyle.grammars;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -36,7 +37,7 @@ public class Java7DiamondTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("grammars/InputJava7Diamond.java"), expected);
}
}

View File

@ -19,6 +19,7 @@
package com.puppycrawl.tools.checkstyle.grammars;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -36,7 +37,7 @@ public class Java7MultiCatchTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("grammars/InputJava7MultiCatch.java"), expected);
}
}

View File

@ -19,6 +19,7 @@
package com.puppycrawl.tools.checkstyle.grammars;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -36,7 +37,7 @@ public class Java7NumericalLiteralsTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("grammars/InputJava7NumericalLiterals.java"), expected);
}
}

View File

@ -19,6 +19,7 @@
package com.puppycrawl.tools.checkstyle.grammars;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -36,7 +37,7 @@ public class Java7StringSwitchTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("grammars/InputJava7StringSwitch.java"), expected);
}
}

View File

@ -19,6 +19,7 @@
package com.puppycrawl.tools.checkstyle.grammars;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
@ -36,7 +37,7 @@ public class Java7TryWithResourcesTest
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(MemberNameCheck.class);
final String[] expected = {};
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("grammars/InputJava7TryWithResources.java"), expected);
}
}

Some files were not shown because too many files have changed in this diff Show More