diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/OuterTypeFilenameTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/OuterTypeFilenameTest.java index eac798d04..c59f64956 100644 --- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/OuterTypeFilenameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/OuterTypeFilenameTest.java @@ -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"); diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrapTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrapTest.java index 158f23a3c..3be581aee 100644 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrapTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrapTest.java @@ -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"); diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandsoacing/CustomImportOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandsoacing/CustomImportOrderTest.java index 8164c87c0..bf281bb22 100644 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandsoacing/CustomImportOrderTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandsoacing/CustomImportOrderTest.java @@ -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"); diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/OneTopLevelClassTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/OneTopLevelClassTest.java index 77a6993e2..3b4e6ff08 100644 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/OneTopLevelClassTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/OneTopLevelClassTest.java @@ -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"); diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyRightCurlyTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyRightCurlyTest.java index 1697c0c34..37285aa6d 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyRightCurlyTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyRightCurlyTest.java @@ -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); diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyCatchBlockTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyCatchBlockTest.java index febd97c21..eb8fe5255 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyCatchBlockTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyCatchBlockTest.java @@ -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"); diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAroundTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAroundTest.java index c3a5f3edd..e783d9bad 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAroundTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAroundTest.java @@ -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"); diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4841indentation/IndentationTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4841indentation/IndentationTest.java index 9527ed9a5..17d714b28 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4841indentation/IndentationTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4841indentation/IndentationTest.java @@ -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"); diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNameTest.java index 842494091..68b25f624 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNameTest.java @@ -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"); diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/JavadocParagraphTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/JavadocParagraphTest.java index e27f89be8..b43b2545f 100644 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/JavadocParagraphTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/JavadocParagraphTest.java @@ -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"); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java index b5863cc11..3bc8d0c41 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java index 46e48bd12..b1d6925c3 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java index 9937ba772..19d38e17b 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java index b9c9ec434..00a767ec2 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java @@ -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"), diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java index e23c5a311..1d3fd91c7 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java index 27c34769d..fef1dffa3 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java index 405a9fee9..8ec298221 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java @@ -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")), }; diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java index e334ae696..12365497e 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java index 541423cec..7e514aac6 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleTest.java index bfb45efd0..e8fcc7b4c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedTest.java index 2b235b089..42a951602 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckTest.java index 60cf817b9..ea02659af 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationTest.java index abc586575..cc4613992 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java index 65b89cbc3..9227e371a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckTest.java index e6049b7e3..17510659a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java index b7aa48f71..8148fc2f0 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java index 9c1c616b7..9ac4c8431 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java @@ -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/" diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java index e7efa6899..37de5fd04 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java index 9a37ba067..6d298618b 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java index 23b037824..33e782d1e 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java @@ -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(), diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckTest.java index bc0327bb6..0d7bca49f 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheckTest.java index 6075a308f..9f83ad714 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java index bc58fcb6b..9d5f0381c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java index 3c4cd9084..beca23296 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheckTest.java index 475afdc97..06927db1b 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheckTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java index 6cd0d05ed..a21b19bbf 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java index 32b4a6b20..db21754a6 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java index 14f78341b..8c9fd38fd 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java index 50ff7ff23..1d9c2057e 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheckTest.java index 3fbadb976..a5f4ddb23 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheckTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheckTest.java index d0751080b..d8f2d310f 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheckTest.java index c22db47ac..870b047b6 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheckTest.java index 44cff2155..fcfdf8502 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckTest.java index 7d00314a9..1f4726c18 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckTest.java @@ -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/" diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java index f97f2ed1e..d1f5cb091 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java index 0754c690f..e1f35bb7b 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java @@ -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 { */ 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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java index 26abc0566..0cd6dfce8 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java index 5a6ba8618..1dc988353 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java index b0a8ee839..cbbad88c4 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandlerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandlerTest.java index 6755addf8..fc527b1df 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandlerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandlerTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheckTest.java index 86bad0d9a..de0e08320 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java index 4be25172c..fb031c4f1 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java index 172a84e16..8b96f4704 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheckTest.java index 1c3bc59b8..58eef5914 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheckTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java index 32d22c1d7..5b0fb7200 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java index 970c197ac..0722c60b5 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java @@ -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; diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheckTest.java index b46529f96..054cd8004 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java index 19b1aaa5e..dd9a59a17 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java index 739224686..5131c65c7 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheckTest.java index 8045783ba..8f7de4ef8 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java index 7b3f5564a..9a74ca6f9 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheckTest.java index 10b8407ab..29d08dbe6 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java index d1feb3465..72d784f26 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java @@ -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(), diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheckTest.java index 02d995a32..26b5392de 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java index 77245c868..8c7ea1ead 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java @@ -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(), diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java index 091f254fe..69ae6b000 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java index 6cc4bd157..00b1a5cc3 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java index 049c4bfc7..3d1fae8fa 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java index e8f058c25..241b78724 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java index 9dd03fe90..9c54f9204 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckTest.java index 3deb8ef15..3fef3992c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckTest.java @@ -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(), diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java index 5955acf3d..ab327c7cb 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckTest.java index f46af6997..d86a79d80 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java index 1551a5e07..17352bdd8 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java index c7b2c0ed5..e60bfec86 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java index 313f87d01..f10ddafad 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckTest.java index f98cb1010..9b21ae8db 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckTest.java @@ -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"), diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java index cba35dd4f..e2bf6fbd6 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java index 32ff0f643..5fa4406fe 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java index 5e367938e..fc5df7b79 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java index 6d3381cf4..91daefe31 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java index da9260112..d00592888 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java index fdc253a25..ab68413ae 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheckTest.java index e7da6b2c3..976f142d7 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java index ad4483b7a..01b822e13 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java index e9f4e9c78..79da772d7 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java index 177df7ab5..cc259f1af 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java index 85dcfe1d7..9b708d8e0 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundTest.java index fb5a5a303..1c81a4915 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundTest.java @@ -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); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/comments/AllBlockCommentsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/comments/AllBlockCommentsTest.java index 4c3baa0af..eb8577420 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/comments/AllBlockCommentsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/comments/AllBlockCommentsTest.java @@ -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()); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/comments/AllSinglelineCommentsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/comments/AllSinglelineCommentsTest.java index 6e0ff03b2..a491cfb88 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/comments/AllSinglelineCommentsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/comments/AllSinglelineCommentsTest.java @@ -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()); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/comments/CommentsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/comments/CommentsTest.java index 056089d69..26b4b2650 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/comments/CommentsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/comments/CommentsTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java index 83ffa9edb..fe55ac463 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/GeneratedJava14LexerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/GeneratedJava14LexerTest.java index 0d1123738..cbd193141 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/GeneratedJava14LexerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/GeneratedJava14LexerTest.java @@ -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); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java index d09654e1b..ec81ab87c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7DiamondTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7DiamondTest.java index 934ccb3ab..f820abb12 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7DiamondTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7DiamondTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7MultiCatchTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7MultiCatchTest.java index 8e0dc11d1..27df08695 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7MultiCatchTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7MultiCatchTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7NumericalLiteralsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7NumericalLiteralsTest.java index 2c28dd827..6876365a9 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7NumericalLiteralsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7NumericalLiteralsTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7StringSwitchTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7StringSwitchTest.java index 0bb6d0ada..2a6f3e0dc 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7StringSwitchTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7StringSwitchTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7TryWithResourcesTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7TryWithResourcesTest.java index a8da5cf92..89b5d91bb 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7TryWithResourcesTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7TryWithResourcesTest.java @@ -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); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/LineCommentAtTheEndOfFileTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/LineCommentAtTheEndOfFileTest.java index 2a1485bb4..40bb99917 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/LineCommentAtTheEndOfFileTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/LineCommentAtTheEndOfFileTest.java @@ -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; @@ -38,7 +39,7 @@ public class LineCommentAtTheEndOfFileTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = {}; + final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("grammars/LineCommentAtTheEndOfFile.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/MultiDimensionalArraysInGenericsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/MultiDimensionalArraysInGenericsTest.java index ee33bc664..3d58e3759 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/MultiDimensionalArraysInGenericsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/MultiDimensionalArraysInGenericsTest.java @@ -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; @@ -32,7 +33,7 @@ public class MultiDimensionalArraysInGenericsTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = {}; + final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("grammars/MultiDimensionalArraysInGenericsTestInput.java"), expected); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/UnicodeEscapeTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/UnicodeEscapeTest.java index 645f29134..8dd6032d4 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/UnicodeEscapeTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/UnicodeEscapeTest.java @@ -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 UnicodeEscapeTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = {}; + final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("grammars/UnicodeEscape.java"), expected); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java index 490b3816e..7f4080e6d 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java @@ -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 VarargTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = {}; + final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("grammars/InputVararg.java"), expected); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/AnnotationTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/AnnotationTest.java index 5e1fa938c..1001a17dc 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/AnnotationTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/AnnotationTest.java @@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; +import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -34,7 +35,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = {}; + final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("grammars/java8/InputAnnotationsTest1.java"), expected); @@ -45,7 +46,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" @@ -58,7 +59,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" @@ -71,7 +72,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" @@ -84,7 +85,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" @@ -97,7 +98,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" @@ -110,7 +111,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" @@ -123,7 +124,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" @@ -136,7 +137,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" @@ -149,7 +150,7 @@ public class AnnotationTest extends BaseCheckTestSupport { 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/java8/" diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/DefaulMethodsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/DefaulMethodsTest.java index d5a728542..25446f911 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/DefaulMethodsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/DefaulMethodsTest.java @@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; +import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -34,7 +35,7 @@ public class DefaulMethodsTest extends BaseCheckTestSupport { 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/java8/" @@ -48,7 +49,7 @@ public class DefaulMethodsTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = {}; + final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("grammars/java8/InputDefaultMethodsTest2.java"), expected); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/LambdaTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/LambdaTest.java index 13a4fa189..6dd03534d 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/LambdaTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/LambdaTest.java @@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; +import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -34,7 +35,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest1.java").getCanonicalPath(), expected); @@ -46,7 +47,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest2.java").getCanonicalPath(), expected); @@ -58,7 +59,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest3.java").getCanonicalPath(), expected); @@ -70,7 +71,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest4.java").getCanonicalPath(), expected); @@ -82,7 +83,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest5.java").getCanonicalPath(), expected); @@ -94,7 +95,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest6.java").getCanonicalPath(), expected); @@ -106,7 +107,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest7.java").getCanonicalPath(), expected); @@ -118,7 +119,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest8.java").getCanonicalPath(), expected); @@ -130,7 +131,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest9.java").getCanonicalPath(), expected); @@ -142,7 +143,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest10.java").getCanonicalPath(), expected); @@ -154,7 +155,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest11.java").getCanonicalPath(), expected); @@ -166,7 +167,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest12.java").getCanonicalPath(), expected); @@ -178,7 +179,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest13.java").getCanonicalPath(), expected); @@ -190,7 +191,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest14.java").getCanonicalPath(), expected); @@ -202,7 +203,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest15.java").getCanonicalPath(), expected); @@ -214,7 +215,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest16.java").getCanonicalPath(), expected); @@ -226,7 +227,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest17.java").getCanonicalPath(), expected); @@ -238,7 +239,7 @@ public class LambdaTest extends BaseCheckTestSupport { 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/java8/InputLambdaTest18.java").getCanonicalPath(), expected); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/MethodReferencesTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/MethodReferencesTest.java index 498c6588a..e869b0c2a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/MethodReferencesTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/MethodReferencesTest.java @@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; +import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -34,7 +35,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { 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/java8/" + "InputMethodReferencesTest.java").getCanonicalPath(), expected); @@ -46,7 +47,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { 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/java8/" + "InputMethodReferencesTest2.java").getCanonicalPath(), expected); @@ -58,7 +59,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { 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/java8/" + "InputMethodReferencesTest3.java").getCanonicalPath(), expected);