diff --git a/config/import-control.xml b/config/import-control.xml index accd8627a..df7ae9e87 100644 --- a/config/import-control.xml +++ b/config/import-control.xml @@ -17,7 +17,6 @@ - diff --git a/config/suppressions.xml b/config/suppressions.xml index 66d4e0687..33541357b 100644 --- a/config/suppressions.xml +++ b/config/suppressions.xml @@ -13,10 +13,10 @@ See https://github.com/checkstyle/checkstyle/issues/2285--> + lines="315"/> + lines="320"/> - - - + + + diff --git a/pom.xml b/pom.xml index 6ed82268e..ff055121c 100644 --- a/pom.xml +++ b/pom.xml @@ -218,11 +218,6 @@ - - org.apache.commons - commons-lang3 - 3.4 - antlr antlr diff --git a/src/it/java/com/google/checkstyle/test/base/ConfigValidationTest.java b/src/it/java/com/google/checkstyle/test/base/ConfigValidationTest.java index 2d8e168f8..a43691adc 100644 --- a/src/it/java/com/google/checkstyle/test/base/ConfigValidationTest.java +++ b/src/it/java/com/google/checkstyle/test/base/ConfigValidationTest.java @@ -19,8 +19,8 @@ package com.google.checkstyle.test.base; -import static org.apache.commons.lang3.ArrayUtils.EMPTY_INTEGER_OBJECT_ARRAY; -import static org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY; +import static com.puppycrawl.tools.checkstyle.utils.CommonUtils.EMPTY_INTEGER_OBJECT_ARRAY; +import static com.puppycrawl.tools.checkstyle.utils.CommonUtils.EMPTY_STRING_ARRAY; import java.io.File; import java.util.ArrayList; 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 180a41c33..b28f6c84c 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 @@ -24,12 +24,12 @@ import static com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck.MSG_ import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class OuterTypeFilenameTest extends BaseCheckTestSupport { @@ -42,7 +42,7 @@ public class OuterTypeFilenameTest extends BaseCheckTestSupport { @Test public void outerTypeFilenameTest1() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("OuterTypeFilename"); final String filePath = getPath("InputOuterTypeFilename1.java"); @@ -54,7 +54,7 @@ public class OuterTypeFilenameTest extends BaseCheckTestSupport { @Test public void outerTypeFilenameTest2() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("OuterTypeFilename"); final String filePath = getPath("InputOuterTypeFilename2.java"); 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 0c63d2707..f83fb6107 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 @@ -22,13 +22,13 @@ package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck; import com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class NoLineWrapTest extends BaseCheckTestSupport { @@ -56,7 +56,7 @@ public class NoLineWrapTest extends BaseCheckTestSupport { @Test public void goodLineWrapTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("NoLineWrap"); final String filePath = getPath("InputNoLineWrapGood.java"); diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/CustomImportOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/CustomImportOrderTest.java index c11486c11..260636e50 100644 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/CustomImportOrderTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/CustomImportOrderTest.java @@ -22,12 +22,12 @@ package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspaci import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class CustomImportOrderTest extends BaseCheckTestSupport { @@ -124,7 +124,7 @@ public class CustomImportOrderTest extends BaseCheckTestSupport { @Test public void validTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("CustomImportOrder"); final String filePath = getPath("InputCustomImportOrderValid.java"); 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 db7f42b6d..01384e5ea 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 @@ -22,12 +22,12 @@ package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.design.OneTopLevelClassCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class OneTopLevelClassTest extends BaseCheckTestSupport { @@ -62,7 +62,7 @@ public class OneTopLevelClassTest extends BaseCheckTestSupport { @Test public void goodTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("OneTopLevelClass"); final String filePath = getPath("InputOneTopLevelClassGood.java"); diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java index 38afb78ca..861ecc98c 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java @@ -25,13 +25,13 @@ 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.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck; import com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyOption; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RightCurlyTest extends BaseCheckTestSupport { @@ -65,7 +65,7 @@ public class RightCurlyTest extends BaseCheckTestSupport { final DefaultConfiguration newCheckConfig = createCheckConfig(RightCurlyCheck.class); newCheckConfig.addAttribute("option", RightCurlyOption.SAME.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final String filePath = getPath("InputRightCurlySame.java"); final Integer[] warnList = 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 4d53d0db7..7903be000 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 @@ -22,12 +22,12 @@ package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.blocks.EmptyCatchBlockCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class EmptyCatchBlockTest extends BaseCheckTestSupport { @@ -56,7 +56,7 @@ public class EmptyCatchBlockTest extends BaseCheckTestSupport { @Test public void testNoViolations() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("EmptyCatchBlock"); final String filePath = getPath("InputEmptyCatchBlockNoViolations.java"); 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 dc6150f10..f1ece5a56 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 @@ -22,11 +22,11 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespac import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class WhitespaceAroundTest extends BaseCheckTestSupport { @@ -75,7 +75,7 @@ public class WhitespaceAroundTest extends BaseCheckTestSupport { @Test public void whitespaceAroundEmptyTypesCyclesTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("WhitespaceAround"); final String filePath = getPath("InputWhitespaceAroundEmptyTypesAndCycles.java"); 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 da9a2f5d0..50ca7806a 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 @@ -22,11 +22,11 @@ package com.google.checkstyle.test.chapter4formatting.rule4841indentation; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseIndentationCheckSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class IndentationTest extends BaseIndentationCheckSupport { @@ -39,7 +39,7 @@ public class IndentationTest extends BaseIndentationCheckSupport { @Test public void correctClassTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("Indentation"); final String filePath = getPath("InputIndentationCorrectClass.java"); @@ -51,7 +51,7 @@ public class IndentationTest extends BaseIndentationCheckSupport { @Test public void correctFieldTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("Indentation"); final String filePath = getPath("InputIndentationCorrectFieldAndParameter.java"); @@ -63,7 +63,7 @@ public class IndentationTest extends BaseIndentationCheckSupport { @Test public void correctForTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("Indentation"); final String filePath = getPath("InputIndentationCorrectForAndParameter.java"); @@ -75,7 +75,7 @@ public class IndentationTest extends BaseIndentationCheckSupport { @Test public void correctIfTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("Indentation"); final String filePath = getPath("InputIndentationCorrectIfAndParameter.java"); @@ -87,7 +87,7 @@ public class IndentationTest extends BaseIndentationCheckSupport { @Test public void correctTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("Indentation"); final String filePath = getPath("InputIndentationCorrect.java"); @@ -99,7 +99,7 @@ public class IndentationTest extends BaseIndentationCheckSupport { @Test public void correctReturnTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("Indentation"); final String filePath = getPath("InputIndentationCorrectReturnAndParameter.java"); @@ -111,7 +111,7 @@ public class IndentationTest extends BaseIndentationCheckSupport { @Test public void correctWhileTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("Indentation"); final String filePath = getPath("InputIndentationCorrectWhileDoWhileAndParameter.java"); 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 8ef447399..da574aef2 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 @@ -22,13 +22,13 @@ 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; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class PackageNameTest extends BaseCheckTestSupport { @@ -50,7 +50,7 @@ public class PackageNameTest extends BaseCheckTestSupport { @Test public void goodPackageNameTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final String filePath = getPath("packagenames", "InputPackageNameGood.java"); 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 4e2e87874..ecbcfc298 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 @@ -22,12 +22,12 @@ package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class JavadocParagraphTest extends BaseCheckTestSupport { @@ -40,7 +40,7 @@ public class JavadocParagraphTest extends BaseCheckTestSupport { @Test public void javadocParagraphCorrectTest() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("JavadocParagraph"); final String filePath = getPath("InputCorrectJavadocParagraphCheck.java"); diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/AtclauseOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/AtclauseOrderTest.java index 42248e0e8..f0e15bb88 100644 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/AtclauseOrderTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/AtclauseOrderTest.java @@ -22,12 +22,12 @@ package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.javadoc.AtclauseOrderCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AtclauseOrderTest extends BaseCheckTestSupport { @@ -40,7 +40,7 @@ public class AtclauseOrderTest extends BaseCheckTestSupport { @Test public void testCorrect() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("AtclauseOrder"); final String filePath = getPath("InputCorrectAtClauseOrderCheck.java"); diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/SummaryJavadocTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/SummaryJavadocTest.java index f5c66cbe1..d14fa3bd8 100644 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/SummaryJavadocTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/SummaryJavadocTest.java @@ -22,12 +22,12 @@ package com.google.checkstyle.test.chapter7javadoc.rule72thesummaryfragment; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.checkstyle.test.base.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class SummaryJavadocTest extends BaseCheckTestSupport { @@ -40,7 +40,7 @@ public class SummaryJavadocTest extends BaseCheckTestSupport { @Test public void testCorrect() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final Configuration checkConfig = getCheckConfig("SummaryJavadoc"); final String filePath = getPath("InputCorrectSummaryJavaDocCheck.java"); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java index d603eedac..a560082f2 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java @@ -28,7 +28,6 @@ import java.util.Locale; import java.util.Set; import java.util.SortedSet; -import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -95,7 +94,7 @@ public class Checker extends AutomaticBean implements MessageDispatcher { private Context childContext; /** The file extensions that are accepted. */ - private String[] fileExtensions = ArrayUtils.EMPTY_STRING_ARRAY; + private String[] fileExtensions = CommonUtils.EMPTY_STRING_ARRAY; /** * The severity level of any violations found by submodules. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java index 17767b440..e6e018f33 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java @@ -22,9 +22,8 @@ package com.puppycrawl.tools.checkstyle.api; import java.util.Collections; import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; - import com.google.common.collect.Sets; + import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** @@ -93,7 +92,7 @@ public abstract class AbstractCheck extends AbstractViolationReporter { * @see TokenTypes */ public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java index 13b21b538..d83bf596d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java @@ -24,8 +24,6 @@ import java.util.Arrays; import java.util.List; import java.util.SortedSet; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** @@ -45,7 +43,7 @@ public abstract class AbstractFileSetCheck private MessageDispatcher messageDispatcher; /** The file extensions that are accepted by this filter. */ - private String[] fileExtensions = ArrayUtils.EMPTY_STRING_ARRAY; + private String[] fileExtensions = CommonUtils.EMPTY_STRING_ARRAY; /** * Called to process a file that matches the specified file extensions. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java index 3059b9ded..198b738dc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java @@ -38,8 +38,6 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.google.common.io.Closeables; /** @@ -154,7 +152,12 @@ public final class FileText extends AbstractList { charset = fileText.charset; fullText = fileText.fullText; lines = fileText.lines.clone(); - lineBreaks = ArrayUtils.clone(fileText.lineBreaks); + if (fileText.lineBreaks == null) { + lineBreaks = null; + } + else { + lineBreaks = fileText.lineBreaks.clone(); + } } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java index c6ca361f4..2eab72610 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java @@ -22,7 +22,7 @@ package com.puppycrawl.tools.checkstyle.api; import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang3.StringUtils; +import com.google.common.base.Joiner; /** * Represents a full identifier, including dots, with associated @@ -76,7 +76,7 @@ public final class FullIdent { * @return the text */ public String getText() { - return StringUtils.join(elements, ""); + return Joiner.on("").join(elements); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java index b33ca80a4..fafd84f7b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java @@ -22,12 +22,11 @@ package com.puppycrawl.tools.checkstyle.checks; import java.util.Arrays; import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; - import antlr.collections.AST; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import com.puppycrawl.tools.checkstyle.utils.TokenUtils; /** @@ -204,7 +203,7 @@ public class DescendantTokenCheck extends AbstractCheck { /** Whether to sum the number of tokens found. */ private boolean sumTokenCounts; /** Limited tokens. */ - private int[] limitedTokens = ArrayUtils.EMPTY_INT_ARRAY; + private int[] limitedTokens = CommonUtils.EMPTY_INT_ARRAY; /** Error message when minimum count not reached. */ private String minimumMessage; /** Error message when maximum count exceeded. */ @@ -214,16 +213,16 @@ public class DescendantTokenCheck extends AbstractCheck { * Counts of descendant tokens. * Indexed by (token ID - 1) for performance. */ - private int[] counts = ArrayUtils.EMPTY_INT_ARRAY; + private int[] counts = CommonUtils.EMPTY_INT_ARRAY; @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/FileContentsHolder.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/FileContentsHolder.java index b5ad76aae..1a7c804f7 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/FileContentsHolder.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/FileContentsHolder.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Holds the current file contents for global access when configured @@ -51,7 +50,7 @@ public class FileContentsHolder @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java index 1a594bab1..fbe4f6888 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java @@ -21,13 +21,12 @@ package com.puppycrawl.tools.checkstyle.checks; import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; - import com.google.common.collect.ImmutableSet; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.utils.CheckUtils; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Check that method/constructor/catch/foreach parameters are final. @@ -109,7 +108,7 @@ public class FinalParametersCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java index 037b40132..d12ded6fb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java @@ -24,8 +24,6 @@ import java.util.Map; import java.util.Set; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.google.common.collect.Sets; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -136,17 +134,17 @@ public class TrailingCommentCheck extends AbstractCheck { @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java index 4bd5f3bfe..73c1b3c1f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.annotation; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Check location of annotation on language elements. @@ -208,7 +207,7 @@ public class AnnotationLocationCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java index 680f44e16..0ef6b09f2 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java @@ -22,8 +22,6 @@ package com.puppycrawl.tools.checkstyle.checks.annotation; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; @@ -148,7 +146,7 @@ public class SuppressWarningsCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java index 0db6089f5..5c198a7f1 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.checks.blocks; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; +import com.google.common.base.CharMatcher; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Checks for empty blocks. The policy to verify is specified using the {@link @@ -136,7 +136,7 @@ public class EmptyBlockCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override @@ -200,7 +200,7 @@ public class EmptyBlockCheck // Handle braces on the same line final String txt = lines[slistLineNo - 1] .substring(slistColNo + 1, rcurlyColNo); - if (StringUtils.isNotBlank(txt)) { + if (!CharMatcher.WHITESPACE.matchesAllOf(txt)) { returnValue = true; } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java index fdaac6300..026e65281 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java @@ -22,7 +22,6 @@ package com.puppycrawl.tools.checkstyle.checks.blocks; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -174,7 +173,7 @@ public class LeftCurlyCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java index 09be96137..0c5d1de9f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.blocks; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -194,7 +193,7 @@ public class NeedBracesCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java index cb396e1ae..67a9ba602 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java @@ -22,7 +22,6 @@ package com.puppycrawl.tools.checkstyle.checks.blocks; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -168,7 +167,7 @@ public class RightCurlyCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java index 1cb0a4ccc..6810da746 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.coding; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import com.puppycrawl.tools.checkstyle.utils.TokenUtils; /** @@ -76,7 +75,7 @@ public class IllegalTokenCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java index 1f4bceacd..bf5dac58b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java @@ -21,8 +21,6 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.utils.CommonUtils; @@ -79,7 +77,7 @@ public class IllegalTokenTextCheck @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override @@ -89,7 +87,7 @@ public class IllegalTokenTextCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java index a353a331f..a68310c6f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java @@ -21,12 +21,11 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import java.util.Arrays; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.utils.CheckUtils; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import com.puppycrawl.tools.checkstyle.utils.ScopeUtils; import com.puppycrawl.tools.checkstyle.utils.TokenUtils; @@ -203,7 +202,7 @@ public class MagicNumberCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override @@ -399,7 +398,7 @@ public class MagicNumberCheck extends AbstractCheck { */ public void setIgnoreNumbers(double... list) { if (list.length == 0) { - ignoreNumbers = ArrayUtils.EMPTY_DOUBLE_ARRAY; + ignoreNumbers = CommonUtils.EMPTY_DOUBLE_ARRAY; } else { ignoreNumbers = new double[list.length]; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java index b104fb6b9..0110c3425 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.coding; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -188,7 +187,7 @@ public class UnnecessaryParenthesesCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { // Check can work with any of acceptable tokens - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java index 4c59bb0a2..dc5e18ef5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java @@ -24,7 +24,7 @@ import java.util.Deque; import java.util.LinkedList; import java.util.List; -import org.apache.commons.lang3.StringUtils; +import com.google.common.base.Joiner; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -161,7 +161,7 @@ public class FinalClassCheck qualifiedNameParts.add(0, traverse.findFirstToken(TokenTypes.IDENT).getText()); traverse = traverse.findFirstToken(TokenTypes.DOT); } - className = StringUtils.join(qualifiedNameParts, PACKAGE_SEPARATOR); + className = Joiner.on(PACKAGE_SEPARATOR).join(qualifiedNameParts); } else { className = classExtend.findFirstToken(TokenTypes.IDENT).getText(); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java index bbe666513..e995745ab 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java @@ -23,11 +23,10 @@ import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Checks that each top-level class, interface @@ -109,7 +108,7 @@ public class OneTopLevelClassCheck extends AbstractCheck { // ZERO tokens as Check do Traverse of Tree himself, he does not need to subscribed to Tokens @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java index 9b270c84a..db9b8bd7f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java @@ -32,8 +32,8 @@ import java.util.List; import java.util.regex.Pattern; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.StringUtils; +import com.google.common.base.CharMatcher; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.io.Closeables; @@ -92,7 +92,7 @@ public abstract class AbstractHeaderCheck extends AbstractFileSetCheck { * @throws CheckstyleException if fileName is empty. */ public void setHeaderFile(String fileName) throws CheckstyleException { - if (StringUtils.isBlank(fileName)) { + if (fileName == null || CharMatcher.WHITESPACE.matchesAllOf(fileName)) { throw new CheckstyleException( "property 'headerFile' is missing or invalid in module " + getConfiguration().getName()); @@ -142,7 +142,7 @@ public abstract class AbstractHeaderCheck extends AbstractFileSetCheck { * @throws ConversionException if the header cannot be interpreted */ public void setHeader(String header) { - if (StringUtils.isBlank(header)) { + if (header == null || CharMatcher.WHITESPACE.matchesAllOf(header)) { return; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java index 27321219d..b29ca3c66 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java @@ -26,8 +26,8 @@ import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.StringUtils; +import com.google.common.base.CharMatcher; import com.google.common.collect.Lists; import com.puppycrawl.tools.checkstyle.utils.CommonUtils; @@ -172,7 +172,7 @@ public class RegexpHeaderCheck extends AbstractHeaderCheck { */ @Override public void setHeader(String header) { - if (StringUtils.isBlank(header)) { + if (header == null || CharMatcher.WHITESPACE.matchesAllOf(header)) { return; } if (!CommonUtils.isPatternValid(header)) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java index 5a09c46b2..0cd838fd2 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java @@ -19,12 +19,11 @@ package com.puppycrawl.tools.checkstyle.checks.imports; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FullIdent; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -73,7 +72,7 @@ public class AvoidStaticImportCheck public static final String MSG_KEY = "import.avoidStatic"; /** The classes/static members to exempt from this check. */ - private String[] excludes = ArrayUtils.EMPTY_STRING_ARRAY; + private String[] excludes = CommonUtils.EMPTY_STRING_ARRAY; @Override public int[] getDefaultTokens() { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java index 1c4de3327..a9ec42ad9 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java @@ -23,8 +23,8 @@ import java.io.File; import java.net.URI; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.StringUtils; +import com.google.common.base.CharMatcher; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -143,7 +143,7 @@ public class ImportControlCheck extends AbstractCheck { */ public void setFile(final String name) { // Handle empty param - if (StringUtils.isBlank(name)) { + if (name == null || CharMatcher.WHITESPACE.matchesAllOf(name)) { return; } @@ -163,7 +163,7 @@ public class ImportControlCheck extends AbstractCheck { */ public void setUrl(final String url) { // Handle empty param - if (StringUtils.isBlank(url)) { + if (url == null || CharMatcher.WHITESPACE.matchesAllOf(url)) { return; } final URI uri; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java index 26814f1eb..357016eeb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java @@ -23,8 +23,6 @@ import java.util.ArrayDeque; import java.util.Deque; import java.util.Locale; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; @@ -99,7 +97,7 @@ public class CommentsIndentationCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java index ec8fbac8b..252cc30d6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java @@ -26,8 +26,6 @@ import java.util.Locale; import java.util.Set; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.google.common.collect.ImmutableSortedSet; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -36,6 +34,7 @@ import com.puppycrawl.tools.checkstyle.api.Scope; import com.puppycrawl.tools.checkstyle.api.TextBlock; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.utils.CheckUtils; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import com.puppycrawl.tools.checkstyle.utils.ScopeUtils; /** @@ -134,7 +133,7 @@ public class JavadocStyleCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java index a5b929ec0..eaf55b76c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java @@ -23,8 +23,6 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; @@ -187,7 +185,7 @@ public class JavadocTypeCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java index 274e4db69..164c9049e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java @@ -22,8 +22,6 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; @@ -151,7 +149,7 @@ public class WriteTagCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java index 3fe116226..f88ea4bda 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java @@ -22,11 +22,10 @@ package com.puppycrawl.tools.checkstyle.checks.modifier; import java.util.ArrayList; import java.util.List; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Checks for redundant modifiers in interface and annotation definitions, @@ -120,7 +119,7 @@ public class RedundantModifierCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java index 66c35ab16..6de0db6c6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java @@ -25,11 +25,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -195,7 +194,7 @@ public class AbbreviationAsWordInNameCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java index 2a6bcca13..33cf5e097 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java @@ -19,10 +19,9 @@ package com.puppycrawl.tools.checkstyle.checks.naming; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import com.puppycrawl.tools.checkstyle.utils.ScopeUtils; /** @@ -73,7 +72,7 @@ public class LocalFinalVariableNameCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.java index c835f4511..d424ab647 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.java @@ -19,9 +19,8 @@ package com.puppycrawl.tools.checkstyle.checks.naming; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -78,6 +77,6 @@ public class TypeNameCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java index 9a1381871..295780f28 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java @@ -21,7 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.regexp; import java.util.regex.Pattern; -import org.apache.commons.lang3.ObjectUtils; +import com.google.common.base.Objects; import com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter; @@ -228,8 +228,8 @@ public final class DetectorOptions { * @return DetectorOptions instance. */ public DetectorOptions build() { - message = ObjectUtils.defaultIfNull(message, ""); - suppressor = ObjectUtils.defaultIfNull(suppressor, NeverSuppress.INSTANCE); + message = Objects.firstNonNull(message, ""); + suppressor = Objects.firstNonNull(suppressor, NeverSuppress.INSTANCE); return DetectorOptions.this; } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java index 6133e5568..f7cffad5c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java @@ -22,8 +22,6 @@ package com.puppycrawl.tools.checkstyle.checks.regexp; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; @@ -183,7 +181,7 @@ public class RegexpCheck extends AbstractCheck { @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java index b5bc153fb..7b310694f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java @@ -21,10 +21,9 @@ package com.puppycrawl.tools.checkstyle.checks.regexp; import java.util.Arrays; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Implementation of a check that looks for a single line in Java files. @@ -53,7 +52,7 @@ public class RegexpSinglelineJavaCheck extends AbstractCheck { @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.java index 5e7ece0f0..8f130323c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.java @@ -21,8 +21,6 @@ package com.puppycrawl.tools.checkstyle.checks.sizes; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.utils.CommonUtils; @@ -103,17 +101,17 @@ public class LineLengthCheck extends AbstractCheck { @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java index cdb10d7f1..137da1967 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java @@ -19,12 +19,11 @@ package com.puppycrawl.tools.checkstyle.checks.sizes; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -85,7 +84,7 @@ public class MethodLengthCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java index 57dcd8695..054d41154 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java @@ -19,12 +19,11 @@ package com.puppycrawl.tools.checkstyle.checks.sizes; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.utils.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -117,7 +116,7 @@ public class ParameterNumberCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java index b7533ef02..0274169eb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java @@ -19,12 +19,11 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Checks for empty line separators after header, package, all import declarations, @@ -214,7 +213,7 @@ public class EmptyLineSeparatorCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java index a98041bb2..47db2e448 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.java @@ -22,7 +22,6 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -116,7 +115,7 @@ public class MethodParamPadCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheck.java index 7417b6060..e448a44eb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheck.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

Checks that chosen statements are not line-wrapped. @@ -91,7 +90,7 @@ public class NoLineWrapCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java index 7220a4925..e37511dec 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -96,7 +95,7 @@ public class NoWhitespaceBeforeCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.java index 028cb1b4a..7e02a9abe 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.java @@ -22,9 +22,8 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.StringUtils; +import com.google.common.base.CharMatcher; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; @@ -198,7 +197,7 @@ public class OperatorWrapCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override @@ -222,7 +221,8 @@ public class OperatorWrapCheck // itself. if (option == WrapOption.NL && !text.equals(currentLine.trim()) - && StringUtils.isBlank(currentLine.substring(colNo + text.length()))) { + && CharMatcher.WHITESPACE.matchesAllOf( + currentLine.substring(colNo + text.length()))) { log(lineNo, colNo, MSG_LINE_NEW, text); } else if (option == WrapOption.EOL diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java index 5d83b5173..db192dc7e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java @@ -21,10 +21,9 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; import java.util.Arrays; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

Checks the padding of parentheses; that is whether a space is required @@ -110,7 +109,7 @@ public class ParenPadCheck extends AbstractParenPadCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheck.java index c553d2968..0aecb1078 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheck.java @@ -22,11 +22,11 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -139,7 +139,7 @@ public class SeparatorWrapCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java index a8d1eba68..303bb8f04 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** *

@@ -85,7 +84,7 @@ public class WhitespaceAfterCheck @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java index adf8d5db5..606c270c4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.java @@ -19,11 +19,10 @@ package com.puppycrawl.tools.checkstyle.checks.whitespace; -import org.apache.commons.lang3.ArrayUtils; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Checks that a token is surrounded by whitespace. @@ -308,7 +307,7 @@ public class WhitespaceAroundCheck extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtility.java b/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtility.java index 85328b122..70081322a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtility.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtility.java @@ -19,8 +19,7 @@ package com.puppycrawl.tools.checkstyle.utils; -import org.apache.commons.lang3.StringUtils; - +import com.google.common.base.CharMatcher; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FullIdent; import com.puppycrawl.tools.checkstyle.api.TokenTypes; @@ -147,7 +146,7 @@ public final class AnnotationUtility { throw new IllegalArgumentException("the annotation is null"); } - if (StringUtils.isBlank(annotation)) { + if (CharMatcher.WHITESPACE.matchesAllOf(annotation)) { throw new IllegalArgumentException( "the annotation is empty or spaces"); } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtils.java b/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtils.java index 9a54558f6..68a8c7b32 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtils.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtils.java @@ -45,6 +45,19 @@ import com.puppycrawl.tools.checkstyle.api.CheckstyleException; */ public final class CommonUtils { + /** Copied from org.apache.commons.lang3.ArrayUtils. */ + public static final String[] EMPTY_STRING_ARRAY = new String[0]; + /** Copied from org.apache.commons.lang3.ArrayUtils. */ + public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY = new Integer[0]; + /** Copied from org.apache.commons.lang3.ArrayUtils. */ + public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; + /** Copied from org.apache.commons.lang3.ArrayUtils. */ + public static final int[] EMPTY_INT_ARRAY = new int[0]; + /** Copied from org.apache.commons.lang3.ArrayUtils. */ + public static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; + /** Copied from org.apache.commons.lang3.ArrayUtils. */ + public static final double[] EMPTY_DOUBLE_ARRAY = new double[0]; + /** Prefix for the exception when unable to find resource. */ private static final String UNABLE_TO_FIND_EXCEPTION_PREFIX = "Unable to find: "; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtils.java b/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtils.java index efe03dbf0..e035c79d1 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtils.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtils.java @@ -25,8 +25,6 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; - import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -88,7 +86,7 @@ public final class JavadocUtils { final Field[] fields = JavadocTokenTypes.class.getDeclaredFields(); - String[] tempTokenValueToName = ArrayUtils.EMPTY_STRING_ARRAY; + String[] tempTokenValueToName = CommonUtils.EMPTY_STRING_ARRAY; for (final Field field : fields) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtils.java b/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtils.java index 6c4f6631d..f1594b4be 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtils.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtils.java @@ -22,10 +22,8 @@ package com.puppycrawl.tools.checkstyle.utils; import java.lang.reflect.Field; import java.util.ResourceBundle; -import org.apache.commons.lang3.ArrayUtils; - -import com.google.common.collect.ImmutableCollection; import com.google.common.collect.ImmutableMap; +import com.google.common.primitives.Ints; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** @@ -54,7 +52,7 @@ public final class TokenUtils { final ImmutableMap.Builder builder = ImmutableMap.builder(); final Field[] fields = TokenTypes.class.getDeclaredFields(); - String[] tempTokenValueToName = ArrayUtils.EMPTY_STRING_ARRAY; + String[] tempTokenValueToName = CommonUtils.EMPTY_STRING_ARRAY; for (final Field field : fields) { // Only process the int declarations. if (field.getType() != Integer.TYPE) { @@ -75,9 +73,7 @@ public final class TokenUtils { TOKEN_NAME_TO_VALUE = builder.build(); TOKEN_VALUE_TO_NAME = tempTokenValueToName; - final ImmutableCollection values = TOKEN_NAME_TO_VALUE.values(); - final Integer[] ids = values.toArray(new Integer[values.size()]); - TOKEN_IDS = ArrayUtils.toPrimitive(ids); + TOKEN_IDS = Ints.toArray(TOKEN_NAME_TO_VALUE.values()); } /** Stop instances being created. **/ diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java index 3e100da6a..8039eb00c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java @@ -40,7 +40,6 @@ import java.util.List; import java.util.Locale; import java.util.SortedSet; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assume; import org.junit.Rule; import org.junit.Test; @@ -54,6 +53,7 @@ import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.api.LocalizedMessage; import com.puppycrawl.tools.checkstyle.checks.TranslationCheck; import com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class CheckerTest extends BaseCheckTestSupport { @@ -391,7 +391,7 @@ public class CheckerTest extends BaseCheckTestSupport { checker.addListener(new BriefUtLogger(stream)); final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath(); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checker, pathToEmptyFile, pathToEmptyFile, expected); // one more time to reuse cache @@ -419,7 +419,7 @@ public class CheckerTest extends BaseCheckTestSupport { checker.addListener(new BriefUtLogger(stream)); final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath(); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checker, pathToEmptyFile, pathToEmptyFile, expected); @@ -476,7 +476,7 @@ public class CheckerTest extends BaseCheckTestSupport { checker.addListener(new BriefUtLogger(stream)); final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath(); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checker, pathToEmptyFile, pathToEmptyFile, expected); checker.clearCache(); @@ -504,7 +504,7 @@ public class CheckerTest extends BaseCheckTestSupport { checker.addListener(new BriefUtLogger(stream)); final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath(); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checker, pathToEmptyFile, pathToEmptyFile, expected); checker.clearCache(); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java index 333ee0192..779e6f9d9 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java @@ -19,7 +19,7 @@ package com.puppycrawl.tools.checkstyle; -import static org.apache.commons.lang3.ArrayUtils.EMPTY_BYTE_ARRAY; +import static com.puppycrawl.tools.checkstyle.utils.CommonUtils.EMPTY_BYTE_ARRAY; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java index 9ab550f94..b9a2642c2 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java @@ -32,7 +32,6 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; @@ -44,6 +43,7 @@ import com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck; import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck; import com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck; import com.puppycrawl.tools.checkstyle.checks.naming.TypeNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class TreeWalkerTest extends BaseCheckTestSupport { @Rule @@ -75,7 +75,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport { final String content = "public class Main { public static final int k = 5 + 4; }"; writer.write(content); } - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, file.getPath(), expected); } @@ -86,8 +86,8 @@ public class TreeWalkerTest extends BaseCheckTestSupport { createCheckConfig(HiddenFieldCheck.class); checkConfig.addAttribute("tokens", "VARIABLE_DEF, ENUM_DEF, CLASS_DEF, METHOD_DEF," + "IMPORT"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputMain.java"), expected); fail("CheckstyleException is expected"); } @@ -104,7 +104,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, pathToEmptyFile, expected); } @@ -112,9 +112,9 @@ public class TreeWalkerTest extends BaseCheckTestSupport { @Test public void testWithCheckNotHavingTreeWalkerAsParent() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocPackageCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, temporaryFolder.newFile().getPath(), expected); fail("CheckstyleException is expected"); } @@ -135,9 +135,9 @@ 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 = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, pathToEmptyFile, expected); } catch (CheckstyleException ex) { @@ -215,9 +215,9 @@ public class TreeWalkerTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RequiredTokenIsNotInDefaultsCheck.class); final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath(); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, pathToEmptyFile, expected); fail("CheckstyleException is expected"); } @@ -234,9 +234,9 @@ public class TreeWalkerTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RequiredTokenIsEmptyIntArray.class); final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath(); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, pathToEmptyFile, expected); } catch (CheckstyleException ignored) { @@ -275,14 +275,14 @@ public class TreeWalkerTest extends BaseCheckTestSupport { @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } } private static class RequiredTokenIsEmptyIntArray extends AbstractCheck { @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override @@ -292,7 +292,7 @@ public class TreeWalkerTest extends BaseCheckTestSupport { @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java index 841c18d1d..0271195c3 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java @@ -33,13 +33,13 @@ import java.nio.charset.StandardCharsets; import java.util.List; import java.util.regex.Pattern; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.common.collect.Lists; import com.puppycrawl.tools.checkstyle.api.AuditEvent; import com.puppycrawl.tools.checkstyle.api.LocalizedMessage; import com.puppycrawl.tools.checkstyle.api.SeverityLevel; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Enter a description of class XMLLoggerTest.java. @@ -107,7 +107,7 @@ public class XMLLoggerTest { final XMLLogger logger = new XMLLogger(outStream, true); logger.auditStarted(null); logger.auditFinished(null); - final String[] expectedLines = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expectedLines = CommonUtils.EMPTY_STRING_ARRAY; verifyLines(expectedLines); } @@ -118,7 +118,7 @@ public class XMLLoggerTest { logger.auditStarted(null); logger.auditFinished(null); outStream.close(); - final String[] expectedLines = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expectedLines = CommonUtils.EMPTY_STRING_ARRAY; verifyLines(expectedLines); } @@ -193,7 +193,7 @@ public class XMLLoggerTest { final AuditEvent ev = new AuditEvent(this, "Test.java", message); logger.addError(ev); logger.auditFinished(null); - final String[] expectedLines = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expectedLines = CommonUtils.EMPTY_STRING_ARRAY; verifyLines(expectedLines); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractCheckTest.java index daace0bcf..384ea5d57 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractCheckTest.java @@ -19,10 +19,11 @@ package com.puppycrawl.tools.checkstyle.api; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; + public class AbstractCheckTest { @Test @@ -30,12 +31,12 @@ public class AbstractCheckTest { final AbstractCheck check = new AbstractCheck() { @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } }; // Eventually it will become clear abstract method - Assert.assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, check.getRequiredTokens()); + Assert.assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, check.getRequiredTokens()); } @Test @@ -43,12 +44,12 @@ public class AbstractCheckTest { final AbstractCheck check = new AbstractCheck() { @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } }; // Eventually it will become clear abstract method - Assert.assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, check.getAcceptableTokens()); + Assert.assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, check.getAcceptableTokens()); } @Test @@ -56,17 +57,17 @@ public class AbstractCheckTest { final AbstractCheck check = new AbstractCheck() { @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } }; // Eventually it will become clear abstract method diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java index f06ad985f..830104259 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java @@ -24,11 +24,11 @@ import static org.junit.Assert.assertEquals; import java.lang.reflect.Method; import java.util.SortedSet; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests to ensure that default message bundle is determined correctly. @@ -122,17 +122,17 @@ public class AbstractViolationReporterTest extends BaseCheckTestSupport { private static class EmptyCheck extends AbstractCheck { @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/api/FileTextTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/api/FileTextTest.java index 0e4fc2f57..6874582b4 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/FileTextTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/FileTextTest.java @@ -49,4 +49,23 @@ public class FileTextTest { + "checkstyle/api/import-control_complete.xml"), charsetName); assertEquals(charsetName, o.getCharset().name()); } + + @Test + public void testLineColumnBeforeCopyConstructor() throws IOException { + final String charsetName = "ISO-8859-1"; + final FileText o = new FileText(new File("src/test/resources/com/puppycrawl/tools/" + + "checkstyle/api/import-control_complete.xml"), charsetName); + final LineColumn lineColumn = o.lineColumn(100); + final FileText copy = new FileText(o); + assertEquals(lineColumn, copy.lineColumn(100)); + } + + @Test + public void testLineColumnAfterCopyConstructor() throws IOException { + final String charsetName = "ISO-8859-1"; + final FileText o = new FileText(new File("src/test/resources/com/puppycrawl/tools/" + + "checkstyle/api/import-control_complete.xml"), charsetName); + final FileText copy = new FileText(o); + assertEquals(3, copy.lineColumn(100).getLine()); + } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessageTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessageTest.java index 523334f96..f1fcacb67 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessageTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/LocalizedMessageTest.java @@ -19,8 +19,8 @@ package com.puppycrawl.tools.checkstyle.api; -import static org.apache.commons.lang3.ArrayUtils.EMPTY_BYTE_ARRAY; -import static org.apache.commons.lang3.ArrayUtils.EMPTY_OBJECT_ARRAY; +import static com.puppycrawl.tools.checkstyle.utils.CommonUtils.EMPTY_BYTE_ARRAY; +import static com.puppycrawl.tools.checkstyle.utils.CommonUtils.EMPTY_OBJECT_ARRAY; import static org.junit.Assert.assertEquals; import static org.powermock.api.mockito.PowerMockito.mock; import static org.powermock.api.mockito.PowerMockito.when; 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 70dc09989..afb97f33c 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java @@ -27,11 +27,11 @@ import static com.puppycrawl.tools.checkstyle.checks.DescendantTokenCheck.MSG_KE import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class DescendantTokenCheckTest extends BaseCheckTestSupport { @Override @@ -44,7 +44,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(DescendantTokenCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputIllegalTokens.java"), expected); } @@ -100,7 +100,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("limitedTokens", "LITERAL_DEFAULT"); checkConfig.addAttribute("maximumNumber", "0"); checkConfig.addAttribute("minimumDepth", "3"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputIllegalTokens.java"), expected); } @@ -113,7 +113,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("limitedTokens", "LITERAL_DEFAULT"); checkConfig.addAttribute("maximumNumber", "0"); checkConfig.addAttribute("maximumDepth", "1"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputIllegalTokens.java"), expected); } @@ -263,7 +263,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("maximumNumber", "1"); checkConfig.addAttribute("maximumMessage", "What are you doing?"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputReturnFromFinally.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 2933c33a5..c4cd08445 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java @@ -27,7 +27,6 @@ import java.io.IOException; import java.util.List; import java.util.Locale; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -38,6 +37,7 @@ import com.puppycrawl.tools.checkstyle.TreeWalker; import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class FileSetCheckLifecycleTest extends BaseCheckTestSupport { @@ -57,14 +57,14 @@ public class FileSetCheckLifecycleTest @Test public void testGetRequiredTokens() { final FileContentsHolder checkObj = new FileContentsHolder(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test public void testTranslation() throws Exception { final Configuration checkConfig = createCheckConfig(TestFileSetCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputIllegalTokens.java"), expected); assertTrue("destroy() not called by Checker", TestFileSetCheck.isDestroyed()); @@ -90,7 +90,7 @@ public class FileSetCheckLifecycleTest checker.addFileSetCheck(new TestFileSetCheck()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checker, getPath("InputIllegalTokens.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 4ff058384..2d80911b5 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java @@ -34,7 +34,6 @@ import java.lang.reflect.Method; import java.util.Iterator; import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.common.collect.Lists; @@ -43,6 +42,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.api.LocalizedMessage; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class NewlineAtEndOfFileCheckTest extends BaseCheckTestSupport { @@ -64,7 +64,7 @@ public class NewlineAtEndOfFileCheckTest final DefaultConfiguration checkConfig = createCheckConfig(NewlineAtEndOfFileCheck.class); checkConfig.addAttribute("lineSeparator", LineSeparatorOption.LF.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify( createChecker(checkConfig), getPath("InputNewlineLfAtEndOfFile.java"), @@ -76,7 +76,7 @@ public class NewlineAtEndOfFileCheckTest final DefaultConfiguration checkConfig = createCheckConfig(NewlineAtEndOfFileCheck.class); checkConfig.addAttribute("lineSeparator", LineSeparatorOption.CRLF.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify( createChecker(checkConfig), getPath("InputNewlineCrlfAtEndOfFile.java"), @@ -88,7 +88,7 @@ public class NewlineAtEndOfFileCheckTest final DefaultConfiguration checkConfig = createCheckConfig(NewlineAtEndOfFileCheck.class); checkConfig.addAttribute("lineSeparator", LineSeparatorOption.CR.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify( createChecker(checkConfig), getPath("InputNewlineCrAtEndOfFile.java"), @@ -100,7 +100,7 @@ public class NewlineAtEndOfFileCheckTest final DefaultConfiguration checkConfig = createCheckConfig(NewlineAtEndOfFileCheck.class); checkConfig.addAttribute("lineSeparator", LineSeparatorOption.LF_CR_CRLF.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 2ed6918a1..3dd7a6321 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport { @Override @@ -59,7 +59,7 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport { public void testGood1() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputIllegalTokens.java"), expected); } @@ -67,7 +67,7 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport { public void testGood2() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("Input15Extensions.java"), expected); } @@ -87,21 +87,21 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport { @Test public void testNestedClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOuterTypeFilename1.java"), expected); } @Test public void testFinePublic() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOuterTypeFilename2.java"), expected); } @Test public void testFineDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOuterTypeFilename3.java"), expected); } @@ -118,7 +118,7 @@ public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport { public void testPackageAnnotation() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("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 a04f6fa15..21901b2d1 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolderTest.java @@ -36,7 +36,6 @@ import java.util.ArrayList; import java.util.List; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.mockito.PowerMockito; @@ -51,6 +50,7 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.LocalizedMessage; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; @RunWith(PowerMockRunner.class) @PrepareForTest({ SuppressWarningsHolder.class, SuppressWarningsHolderTest.class }) @@ -76,7 +76,7 @@ public class SuppressWarningsHolderTest extends BaseCheckTestSupport { public void testOnComplexAnnotations() throws Exception { final Configuration checkConfig = createCheckConfig(SuppressWarningsHolder.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSuppressWarningsHolder.java"), expected); } @@ -85,7 +85,7 @@ public class SuppressWarningsHolderTest extends BaseCheckTestSupport { public void testCustomAnnotation() throws Exception { final Configuration checkConfig = createCheckConfig(SuppressWarningsHolder.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputSuppressWarningsHolder.java"), expected); } @@ -208,7 +208,7 @@ public class SuppressWarningsHolderTest extends BaseCheckTestSupport { public void testEmptyAnnotation() throws Exception { final Configuration checkConfig = createCheckConfig(SuppressWarningsHolder.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSuppressWarningsHolder3.java"), expected); } @@ -315,7 +315,7 @@ public class SuppressWarningsHolderTest extends BaseCheckTestSupport { public void testAnnotationWithFullName() throws Exception { final Configuration checkConfig = createCheckConfig(SuppressWarningsHolder.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSuppressWarningsHolder4.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java index b4556de0d..5134ed582 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java @@ -26,7 +26,6 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -34,6 +33,7 @@ import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class TrailingCommentCheckTest extends BaseCheckTestSupport { private DefaultConfiguration checkConfig; @@ -51,13 +51,13 @@ public class TrailingCommentCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final TrailingCommentCheck checkObj = new TrailingCommentCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test public void testGetAcceptableTokens() { final TrailingCommentCheck checkObj = new TrailingCommentCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getAcceptableTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getAcceptableTokens()); } @Test 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 adfba0237..8dc1bd0ba 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java @@ -25,13 +25,13 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.Method; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.Configuration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class TranslationCheckTest extends BaseCheckTestSupport { @Override @@ -72,7 +72,7 @@ public class TranslationCheckTest extends BaseCheckTestSupport { @Test public void testOnePropertyFileSet() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(TranslationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final File[] propertyFiles = { new File(getPath("app-dev.properties")), }; @@ -207,7 +207,7 @@ public class TranslationCheckTest extends BaseCheckTestSupport { new File(getPath("app-stage.properties")), }; - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify( createChecker(checkConfig), propertyFiles, @@ -247,7 +247,7 @@ public class TranslationCheckTest extends BaseCheckTestSupport { new File(getPath("messages_home_fr_CA_UNIX.properties")), }; - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify( createChecker(checkConfig), propertyFiles, @@ -380,7 +380,7 @@ public class TranslationCheckTest extends BaseCheckTestSupport { new File(getNonCompilablePath("MyLabelsI18_de.properties")), }; - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify( createChecker(checkConfig), 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 1e7f72fcd..103e2ff13 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -35,6 +34,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class UncommentedMainCheckTest extends BaseCheckTestSupport { @@ -83,21 +83,21 @@ public class UncommentedMainCheckTest @Test public void testDeepDepth() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UncommentedMainCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputUncommentedMain2.java"), expected); } @Test public void testWrongName() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UncommentedMainCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputUncommentedMain3.java"), expected); } @Test public void testWrongArrayType() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UncommentedMainCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 16aeb41d3..573df18c0 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 @@ -26,12 +26,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AnnotationLocationCheckTest extends BaseCheckTestSupport { @Override @@ -43,13 +43,13 @@ public class AnnotationLocationCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final AnnotationLocationCheck checkObj = new AnnotationLocationCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test public void testCorrect() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(AnnotationLocationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCorrectAnnotationLocation.java"), expected); } @@ -108,7 +108,7 @@ public class AnnotationLocationCheckTest extends BaseCheckTestSupport { @Test public void testWithoutAnnotations() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(AnnotationLocationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputAnnotationLocation1.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheckTest.java index 0eaa2dcc9..a5a8a3278 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheckTest.java @@ -31,13 +31,13 @@ import java.io.File; import java.io.IOException; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AnnotationUseStyleCheckTest extends BaseCheckTestSupport { @Override @@ -196,7 +196,7 @@ public class AnnotationUseStyleCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "ignore"); checkConfig.addAttribute("trailingArrayComma", "ALWAYS"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputAnnotationUseWithTrailingComma.java"), expected); } @@ -227,7 +227,7 @@ public class AnnotationUseStyleCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "ignore"); checkConfig.addAttribute("trailingArrayComma", "NEVER"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputAnnotationUseNoTrailingComma.java"), expected); } @@ -238,7 +238,7 @@ public class AnnotationUseStyleCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "ignore"); checkConfig.addAttribute("trailingArrayComma", "ignore"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputDifferentUseStyles.java"), expected); } @@ -247,7 +247,7 @@ public class AnnotationUseStyleCheckTest extends BaseCheckTestSupport { public void testAnnotationsWithoutDefaultValues() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "NEVER"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputAnnotationsUseStyleParams.java"), expected); } @@ -278,7 +278,7 @@ public class AnnotationUseStyleCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "COMPACT_NO_ARRAY"); checkConfig.addAttribute("trailingArrayComma", "ignore"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputAnnotationUseStyle.java"), expected); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheckTest.java index 956b17ebb..b3c6f1ff8 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheckTest.java @@ -27,12 +27,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MissingDeprecatedCheckTest extends BaseCheckTestSupport { @Override @@ -138,7 +138,7 @@ public class MissingDeprecatedCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(MissingDeprecatedCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGoodDeprecated.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 71b377f24..4eb9889f7 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 @@ -26,13 +26,13 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MissingOverrideCheckTest extends BaseCheckTestSupport { @Override @@ -108,7 +108,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputBadOverrideFromOther.java"), expected); } @@ -138,7 +138,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { public void testBadAnnotationOverrideJ5Compatible() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputBadAnnotationOverride.java"), expected); } @@ -166,7 +166,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGoodOverrideFromObject.java"), expected); } @@ -180,7 +180,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGoodOverrideFromObject.java"), expected); } @@ -192,7 +192,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { @Test public void testGoodOverrideFromOther() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGoodOverrideFromOther.java"), expected); } @@ -206,7 +206,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGoodOverrideFromOther.java"), expected); } @@ -218,7 +218,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { @Test public void testGoodAnnotationOverride() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGoodAnnotationOverride.java"), expected); } @@ -231,7 +231,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { public void testGoodAnnotationOverrideJ5Compatible() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGoodAnnotationOverride.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheckTest.java index c6f52c509..dd4721384 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheckTest.java @@ -24,13 +24,13 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.PackageAnnotatio import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class PackageAnnotationCheckTest extends BaseCheckTestSupport { @Override @@ -52,7 +52,7 @@ public class PackageAnnotationCheckTest extends BaseCheckTestSupport { public void testGoodPackageAnnotation() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(PackageAnnotationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("package-info.java"), expected); } @@ -69,7 +69,7 @@ public class PackageAnnotationCheckTest extends BaseCheckTestSupport { public void testAnnotationNotInPackageInfo() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(PackageAnnotationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputPackageAnnotation.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheckTest.java index 4e86c150b..9e6375252 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheckTest.java @@ -24,11 +24,11 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.SuppressWarnings import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class SuppressWarningsCheckTest extends BaseCheckTestSupport { @Override @@ -796,7 +796,7 @@ public class SuppressWarningsCheckTest extends BaseCheckTestSupport { public void testUncheckedInConstant() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSuppressWarningsConstants.java"), expected); } @@ -805,7 +805,7 @@ public class SuppressWarningsCheckTest extends BaseCheckTestSupport { public void testValuePairAnnotation() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSuppressWarningsValuePair.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java index e6f8778e3..feed5499a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java @@ -26,12 +26,12 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class EmptyBlockCheckTest extends BaseCheckTestSupport { @@ -142,7 +142,7 @@ public class EmptyBlockCheckTest public void testInvalidOption() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(EmptyBlockCheck.class); checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.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 547baf4b9..1255eedd7 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 @@ -28,7 +28,6 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; @@ -36,6 +35,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class LeftCurlyCheckTest extends BaseCheckTestSupport { private DefaultConfiguration checkConfig; @@ -70,7 +70,7 @@ public class LeftCurlyCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final LeftCurlyCheck checkObj = new LeftCurlyCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @@ -272,7 +272,7 @@ public class LeftCurlyCheckTest extends BaseCheckTestSupport { public void testIgnoreEnumsOptionTrue() throws Exception { checkConfig.addAttribute("option", LeftCurlyOption.EOL.toString()); checkConfig.addAttribute("ignoreEnums", "true"); - final String[] expectedWhileTrue = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expectedWhileTrue = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputLeftCurlyEnums.java"), expectedWhileTrue); } @@ -340,7 +340,7 @@ public class LeftCurlyCheckTest extends BaseCheckTestSupport { public void testFirstLine() throws Exception { checkConfig.addAttribute("option", LeftCurlyOption.EOL.toString()); checkConfig.addAttribute("maxLineLength", "100"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputLeftCurlyAllInOneLine.java"), expected); } @@ -364,7 +364,7 @@ public class LeftCurlyCheckTest extends BaseCheckTestSupport { @Test(expected = CheckstyleException.class) public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputScopeInnerInterfaces.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 1813dbeb3..ad96f8f8d 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 @@ -24,11 +24,11 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck.MSG_ import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class NeedBracesCheckTest extends BaseCheckTestSupport { @Override @@ -120,7 +120,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputNeedBraces.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 60f2e8d94..3267325c4 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 @@ -28,13 +28,13 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RightCurlyCheckTest extends BaseCheckTestSupport { private DefaultConfiguration checkConfig; @@ -88,7 +88,7 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport { @Test public void testSameOmitOneLiners() throws Exception { checkConfig.addAttribute("option", RightCurlyOption.SAME.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRightCurlyNameForOneLiners.java"), expected); } @@ -151,7 +151,7 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport { @Test public void testForceLineBreakBefore2() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRightCurlyLineBreakBefore.java"), expected); } @@ -160,7 +160,7 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport { 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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRightCurlyEmptyAbstractMethod.java"), expected); } @@ -278,7 +278,7 @@ public class RightCurlyCheckTest extends BaseCheckTestSupport { @Test(expected = CheckstyleException.class) public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRightCurly.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 fc68bc380..75b524bcd 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 @@ -24,12 +24,12 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.DefaultComesLastChec import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class DefaultComesLastCheckTest extends BaseCheckTestSupport { @Override @@ -62,7 +62,7 @@ public class DefaultComesLastCheckTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(DefaultComesLastCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputDefaultComesLast2.java"), expected); 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 32cc538c1..ccd2740ab 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 @@ -24,12 +24,12 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck. import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class EqualsHashCodeCheckTest extends BaseCheckTestSupport { @@ -55,7 +55,7 @@ public class EqualsHashCodeCheckTest public void testBooleanMethods() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(EqualsHashCodeCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputEqualsHashCode.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 fd51fe7ab..19aded61d 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 @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCh import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -32,6 +31,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class FinalLocalVariableCheckTest extends BaseCheckTestSupport { @@ -114,7 +114,7 @@ public class FinalLocalVariableCheckTest createCheckConfig(FinalLocalVariableCheck.class); checkConfig.addAttribute("tokens", "PARAMETER_DEF"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputFinalLocalVariableNativeMethods.java"), expected); } @@ -124,7 +124,7 @@ public class FinalLocalVariableCheckTest createCheckConfig(FinalLocalVariableCheck.class); checkConfig.addAttribute("tokens", "VARIABLE_DEF, PARAMETER_DEF"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputFinalLocalVariableFalsePositive.java"), expected); } @@ -160,7 +160,7 @@ public class FinalLocalVariableCheckTest final DefaultConfiguration checkConfig = createCheckConfig(FinalLocalVariableCheck.class); checkConfig.addAttribute("tokens", "PARAMETER_DEF,VARIABLE_DEF"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputFinalLocalVariableNameLambda.java"), 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 9127d0511..0213f7244 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 @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.IllegalInstantiation import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -35,6 +34,7 @@ import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.FileText; import com.puppycrawl.tools.checkstyle.api.LocalizedMessages; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class IllegalInstantiationCheckTest extends BaseCheckTestSupport { @@ -76,7 +76,7 @@ public class IllegalInstantiationCheckTest public void testJava8() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IllegalInstantiationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputIllegalInstantiation2.java"), expected); @@ -120,7 +120,7 @@ public class IllegalInstantiationCheckTest checkConfig.addAttribute( "classes", "jjva.lang.Boolean,java.lang*Boolean"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputIllegalInstantiationLang.java"), expected); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java index 52adc7c0b..79279835d 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java @@ -24,12 +24,12 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.IllegalThrowsCheck.M import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class IllegalThrowsCheckTest extends BaseCheckTestSupport { @Override @@ -112,7 +112,7 @@ public class IllegalThrowsCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(IllegalThrowsCheck.class); checkConfig.addAttribute("ignoreOverriddenMethods", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputIllegalThrowsIgnoreOverriddenMethods.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java index 178c947fb..4c068a17e 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.IllegalTypeCheck.MSG import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -33,6 +32,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class IllegalTypeCheckTest extends BaseCheckTestSupport { private DefaultConfiguration checkConfig; @@ -63,7 +63,7 @@ public class IllegalTypeCheckTest extends BaseCheckTestSupport { @Test public void testValidateAbstractClassNamesSetToFalse() throws Exception { checkConfig.addAttribute("validateAbstractClassNames", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputIllegalTypeAbstractClassNames.java"), expected); } 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 641b106cf..494ffa96b 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 @@ -24,12 +24,12 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class InnerAssignmentCheckTest extends BaseCheckTestSupport { @@ -75,7 +75,7 @@ public class InnerAssignmentCheckTest public void testLambdaExpression() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(InnerAssignmentCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputInnerAssignmentLambdaExpressions.java"), 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 a0edbb309..c24d669d8 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 @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.ModifiedControlVaria import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -32,6 +31,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ModifiedControlVariableCheckTest extends BaseCheckTestSupport { @@ -64,7 +64,7 @@ public class ModifiedControlVariableCheckTest createCheckConfig(ModifiedControlVariableCheck.class); checkConfig.addAttribute("skipEnhancedForLoopVariable", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 b2efa4aaa..49a28ee49 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 @@ -24,12 +24,12 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck. import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * The unit-test for the {@code NestedForDepthCheck}-checkstyle enhancement. @@ -82,7 +82,7 @@ public class NestedForDepthCheckTest extends BaseCheckTestSupport { createCheckConfig(NestedForDepthCheck.class); checkConfig.addAttribute("max", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 37cb6adf2..be9f4e269 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 @@ -24,12 +24,12 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.NestedIfDepthCheck.M import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class NestedIfDepthCheckTest extends BaseCheckTestSupport { @Override @@ -58,7 +58,7 @@ public class NestedIfDepthCheckTest extends BaseCheckTestSupport { createCheckConfig(NestedIfDepthCheck.class); checkConfig.addAttribute("max", "2"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 dff2a33de..efb484bb9 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 @@ -24,11 +24,11 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.NoFinalizerCheck.MSG import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * NoFinalizerCheck test. @@ -59,7 +59,7 @@ public class NoFinalizerCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NoFinalizerCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputFallThrough.java"), expected); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheckTest.java index c001432b9..95964d2e5 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheckTest.java @@ -24,12 +24,12 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.PackageDeclarationCh import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class PackageDeclarationCheckTest extends BaseCheckTestSupport { @Override @@ -70,7 +70,7 @@ public class PackageDeclarationCheckTest extends BaseCheckTestSupport { public void testCorrectFile() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(PackageDeclarationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputPackageDeclaration.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 5c69dd518..b1d8aedd4 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 @@ -25,7 +25,6 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.MSG import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -34,6 +33,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RequireThisCheckTest extends BaseCheckTestSupport { @Override @@ -109,7 +109,7 @@ public class RequireThisCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RequireThisCheck.class); checkConfig.addAttribute("validateOnlyOverlapping", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("Input15Extensions.java"), expected); } @@ -139,7 +139,7 @@ public class RequireThisCheckTest extends BaseCheckTestSupport { public void testWithAnonymousClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RequireThisCheck.class); checkConfig.addAttribute("validateOnlyOverlapping", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRequireThis3.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 e85a7ab73..03ab42f4e 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 @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.ReturnCountCheck.MSG import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -32,6 +31,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ReturnCountCheckTest extends BaseCheckTestSupport { @Override @@ -111,7 +111,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputReturnCountLambda.java"), 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 6125078ae..a6548b4a9 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 @@ -29,12 +29,12 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.UnnecessaryParenthes import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Test fixture for the UnnecessaryParenthesesCheck. @@ -107,7 +107,7 @@ public class UnnecessaryParenthesesCheckTest extends BaseCheckTestSupport { public void test15Extensions() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnnecessaryParenthesesCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 c0df503d9..114cfa6af 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class HideUtilityClassConstructorCheckTest extends BaseCheckTestSupport { @@ -72,7 +72,7 @@ public class HideUtilityClassConstructorCheckTest public void testUtilClassPrivateCtor() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HideUtilityClassConstructorCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputUtilityClassConstructorPrivate.java"), expected); } @@ -81,7 +81,7 @@ public class HideUtilityClassConstructorCheckTest public void testNonUtilClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HideUtilityClassConstructorCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputDesignForExtension.java"), expected); } @@ -89,7 +89,7 @@ public class HideUtilityClassConstructorCheckTest public void testDerivedNonUtilClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HideUtilityClassConstructorCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputNonUtilityClass.java"), expected); } @@ -97,7 +97,7 @@ public class HideUtilityClassConstructorCheckTest public void testOnlyNonStaticFieldNonUtilClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HideUtilityClassConstructorCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegression1762702.java"), expected); } @@ -105,7 +105,7 @@ public class HideUtilityClassConstructorCheckTest public void testEmptyAbstractClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HideUtilityClassConstructorCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputHideUtilityClassConstructor3041574_1.java"), expected); } @@ -113,7 +113,7 @@ public class HideUtilityClassConstructorCheckTest public void testEmptyClassWithOnlyPrivateFields() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HideUtilityClassConstructorCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputHideUtilityClassConstructor3041574_2.java"), expected); } @@ -121,7 +121,7 @@ public class HideUtilityClassConstructorCheckTest public void testClassWithStaticInnerClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HideUtilityClassConstructorCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputHideUtilityClassConstructor3041574_3.java"), expected); } @@ -129,7 +129,7 @@ public class HideUtilityClassConstructorCheckTest public void testProtectedCtor() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HideUtilityClassConstructorCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputHideUtilityClassConstructor.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java index 3f786adb3..15a166ee4 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java @@ -26,7 +26,6 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import antlr.CommonHiddenStreamToken; @@ -35,6 +34,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MutableExceptionCheckTest extends BaseCheckTestSupport { @Override @@ -47,7 +47,7 @@ public class MutableExceptionCheckTest extends BaseCheckTestSupport { public void testClassExtendsGenericClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MutableExceptionCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputMutableExceptionClassExtendsGenericClass.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 53524a790..b9fc9f642 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class OneTopLevelClassCheckTest extends BaseCheckTestSupport { @Override @@ -48,7 +48,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final OneTopLevelClassCheck checkObj = new OneTopLevelClassCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -64,7 +64,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport { public void testFileWithOneTopLevelClass() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OneTopLevelClassCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOneTopLevelClass.java"), expected); } @@ -72,7 +72,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport { public void testFileWithOneTopLevelInterface() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OneTopLevelClassCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOneTopLevelInterface.java"), expected); } @@ -80,7 +80,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport { public void testFileWithOneTopLevelEnum() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OneTopLevelClassCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOneTopLevelEnum.java"), expected); } @@ -145,7 +145,7 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport { @Test public void testPackageInfoWithNoTypesDeclared() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OneTopLevelClassCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("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 f9fe4ed7a..195dddb77 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 @@ -25,7 +25,6 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import antlr.CommonHiddenStreamToken; @@ -35,6 +34,7 @@ import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class VisibilityModifierCheckTest extends BaseCheckTestSupport { @@ -179,7 +179,7 @@ public class VisibilityModifierCheckTest final DefaultConfiguration checkConfig = createCheckConfig(VisibilityModifierCheck.class); checkConfig.addAttribute("immutableClassCanonicalNames", "java.util.Arrays"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImmutableStarImport.java"), expected); } @@ -189,7 +189,7 @@ public class VisibilityModifierCheckTest createCheckConfig(VisibilityModifierCheck.class); checkConfig.addAttribute("immutableClassCanonicalNames", "com.google.common.collect.ImmutableSet"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 3125e7953..91633137a 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 @@ -32,7 +32,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.mockito.PowerMockito; @@ -42,6 +41,7 @@ import org.powermock.modules.junit4.PowerMockRunner; import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; @RunWith(PowerMockRunner.class) @PrepareForTest({ HeaderCheck.class, HeaderCheckTest.class, AbstractHeaderCheck.class }) @@ -72,7 +72,22 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); try { createChecker(checkConfig); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; + verify(checkConfig, getPath("InputRegexpHeader1.java"), expected); + } + catch (CheckstyleException ex) { + // Exception is not expected + fail("Exception is not expected"); + } + } + + @Test + public void testWhitespaceHeader() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); + checkConfig.addAttribute("header", "\n \n"); + try { + createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpHeader1.java"), expected); } catch (CheckstyleException ex) { @@ -133,6 +148,23 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport { } } + @Test + public void testNullFilename() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); + checkConfig.addAttribute("headerFile", null); + try { + createChecker(checkConfig); + fail("Checker creation should not succeed with null headerFile"); + } + catch (CheckstyleException ex) { + assertEquals("cannot initialize module" + + " com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" + + " - Cannot set property 'headerFile' to 'null' in module" + + " com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck", + ex.getMessage()); + } + } + @Test public void testNotMatch() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); @@ -150,7 +182,7 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getConfigPath("java.header")); checkConfig.addAttribute("ignoreLines", "2"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getConfigPath("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 3c9f48aac..89ae654c5 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 @@ -30,12 +30,12 @@ import java.net.URI; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Unit test for RegexpHeaderCheck. @@ -107,7 +107,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport { public void testDefaultConfiguration() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); createChecker(checkConfig); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpHeader1.java"), expected); } @@ -185,7 +185,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp.header1")); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpHeader7.java"), expected); } @@ -195,7 +195,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport { createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp.header2")); checkConfig.addAttribute("multiLines", "3, 6"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpHeader1.java"), expected); } @@ -205,7 +205,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport { createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp.header2")); checkConfig.addAttribute("multiLines", "3, 6"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpHeader2.java"), expected); } @@ -215,7 +215,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport { createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp.header2")); checkConfig.addAttribute("multiLines", "3, 7"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpHeader1.java"), expected); } @@ -225,7 +225,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpHeader3.java"), expected); } @@ -247,7 +247,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport { createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp2.header4")); checkConfig.addAttribute("multiLines", "8974382"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputRegexpHeader6.java"), expected); } @@ -257,7 +257,7 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport { createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp.header2")); checkConfig.addAttribute("multiLines", "3, 6"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 3cb05bc83..4da95565d 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 @@ -32,7 +32,6 @@ import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -40,6 +39,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class CustomImportOrderCheckTest extends BaseCheckTestSupport { /** Shortcuts to make code more compact. */ @@ -261,7 +261,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrderNoValid.java"), expected); } @@ -318,7 +318,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrderThirdPartyPackage.java"), expected); } @@ -456,7 +456,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("separateLineBetweenGroups", "false"); checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(5)"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputCustomImportOrderSamePackageDepth25.java"), expected); @@ -470,7 +470,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("separateLineBetweenGroups", "false"); checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(-1)"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder.java"), expected); } @@ -483,7 +483,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("separateLineBetweenGroups", "false"); checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(0)"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder.java"), expected); } @@ -495,7 +495,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { // #AAA##BBBB###CCCC####DDDD checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(3)###UNSUPPORTED_RULE"); checkConfig.addAttribute("sortImportsInGroupAlphabetically", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder.java"), expected); } @@ -506,7 +506,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder.java"), expected); } @@ -516,7 +516,7 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(CustomImportOrderCheck.class); checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(3)"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder_NoImports.java"), expected); } @@ -525,9 +525,9 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { public void testDefaultConfiguration() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(CustomImportOrderCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder.java"), expected); } @@ -566,9 +566,9 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { "SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE"); checkConfig.addAttribute("specialImportsRegExp", "org"); checkConfig.addAttribute("standardPackageRegExp", "junit"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder_MultiplePatternMatches.java"), expected); } @@ -581,9 +581,9 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { "SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE"); checkConfig.addAttribute("specialImportsRegExp", "Test"); checkConfig.addAttribute("standardPackageRegExp", "unit"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder_MultiplePatternMatches.java"), expected); } @@ -596,9 +596,9 @@ public class CustomImportOrderCheckTest extends BaseCheckTestSupport { "SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE"); checkConfig.addAttribute("specialImportsRegExp", "unit"); checkConfig.addAttribute("standardPackageRegExp", "Test"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomImportOrder_MultiplePatternMatches.java"), expected); } 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 a9d7e2e7b..889d0648d 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 @@ -30,13 +30,13 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ImportControlCheckTest extends BaseCheckTestSupport { @Override @@ -108,12 +108,20 @@ public class ImportControlCheckTest extends BaseCheckTestSupport { verify(checkConfig, getPath("InputImportControl.java"), expected); } + @Test + public void testNull() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class); + checkConfig.addAttribute("file", null); + final String[] expected = {"1:47: " + getCheckMessage(MSG_MISSING_FILE)}; + verify(checkConfig, getPath("InputImportControl.java"), expected); + } + @Test public void testUnknown() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class); checkConfig.addAttribute("file", "unknown-file"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportControl.java"), expected); fail("Test should fail if exception was not thrown"); } @@ -127,8 +135,8 @@ public class ImportControlCheckTest extends BaseCheckTestSupport { public void testBroken() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class); checkConfig.addAttribute("file", getPath("import-control_broken.xml")); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportControl.java"), expected); fail("Test should fail if exception was not thrown"); } @@ -192,13 +200,22 @@ public class ImportControlCheckTest extends BaseCheckTestSupport { verify(checkConfig, getPath("InputImportControl.java"), expected); } + @Test + public void testUrlNull() throws Exception { + final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class); + checkConfig.addAttribute("url", null); + final String[] expected = {"1:47: " + getCheckMessage(MSG_MISSING_FILE)}; + + verify(checkConfig, getPath("InputImportControl.java"), expected); + } + @Test public void testUrlUnableToLoad() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class); checkConfig.addAttribute("url", "https://UnableToLoadThisURL"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportControl.java"), expected); fail("Test should fail if exception was not thrown"); } @@ -212,9 +229,9 @@ public class ImportControlCheckTest extends BaseCheckTestSupport { public void testUrlIncorrectUrl() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class); checkConfig.addAttribute("url", "https://{WrongCharsInURL}"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportControl.java"), expected); fail("Test should fail if exception was not thrown"); } 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 34e14f070..01a611158 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 @@ -26,7 +26,6 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.internal.util.reflection.Whitebox; @@ -40,6 +39,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; @RunWith(PowerMockRunner.class) @PrepareForTest(ImportOrderOption.class) @@ -126,7 +126,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { public void testCaseInsensitive() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class); checkConfig.addAttribute("caseSensitive", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrderCaseInsensitive.java"), expected); } @@ -136,7 +136,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class); checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrder_Top.java"), expected); } @@ -248,7 +248,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { */ checkConfig.addAttribute("groups", "java,javax,org"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrder_WildcardUnspecified.java"), expected); } @@ -257,7 +257,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { public void testNoFailureForRedundantImports() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrder_NoFailureForRedundantImports.java"), expected); } @@ -269,7 +269,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("option", "top"); checkConfig.addAttribute("groups", "org, java"); checkConfig.addAttribute("sortStaticImportsAlphabetically", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrderStaticGroupOrder.java"), expected); } @@ -292,7 +292,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("option", "bottom"); checkConfig.addAttribute("groups", "org, java"); checkConfig.addAttribute("sortStaticImportsAlphabetically", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrderStaticGroupOrderBottom.java"), expected); } @@ -368,7 +368,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("option", "bottom"); checkConfig.addAttribute("groups", "org, java"); checkConfig.addAttribute("sortStaticImportsAlphabetically", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrderStaticOnDemandGroupOrderBottom.java"), expected); } @@ -392,7 +392,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { public void testGroupWithSlashes() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class); checkConfig.addAttribute("groups", "/^javax"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrder.java"), expected); } @@ -401,7 +401,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrder_NoFailureForRedundantImports.java"), expected); @@ -411,7 +411,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputImportOrder_MultiplePatternMatches.java"), expected); @@ -467,7 +467,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("separated", "true"); checkConfig.addAttribute("option", "top"); checkConfig.addAttribute("sortStaticImportsAlphabetically", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 77867d51c..e598fb5e9 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class UnusedImportsCheckTest extends BaseCheckTestSupport { @Override @@ -107,14 +107,14 @@ public class UnusedImportsCheckTest extends BaseCheckTestSupport { @Test public void testAnnotations() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("package-info.java"), expected); } @Test public void testBug() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedImportsCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 5ffc1c589..578c8f692 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 @@ -25,7 +25,6 @@ import static com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndenta import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -33,6 +32,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * @@ -149,7 +149,7 @@ public class CommentsIndentationCheckTest extends BaseCheckTestSupport { public void testNoNpeWhenBlockCommentEndsClassFile() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(CommentsIndentationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; final String testInputFile = "InputCommentsIndentationNoNpe.java"; verify(checkConfig, getPath(testInputFile), 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 baddda78f..f7cafcc1f 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 @@ -39,7 +39,6 @@ import java.util.Locale; 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; @@ -260,7 +259,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputZeroCaseLevel.java"), expected); } @@ -358,7 +357,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputFromGuava2.java"), expected); } @@ -374,7 +373,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputFromGuava.java"), expected); } @@ -390,7 +389,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputIndentationCorrectIfAndParameter.java"), expected); } @@ -406,7 +405,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputAnonymousClasses.java"), expected); } @@ -422,7 +421,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputArrays.java"), expected); } @@ -438,7 +437,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputLabels.java"), expected); } @@ -454,7 +453,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputClassesMethods.java"), expected); } @@ -533,7 +532,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputValidLabelIndent.java"), expected); } @@ -570,7 +569,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidDotIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -704,7 +703,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidSwitchIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -722,7 +721,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidArrayInitDefaultIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -740,7 +739,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidArrayInitIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -810,7 +809,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidTryIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -1190,7 +1189,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidForIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -1208,7 +1207,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidDoWhileIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -1226,7 +1225,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidBlockIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -1244,7 +1243,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidWhileIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -1283,7 +1282,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidInterfaceDefIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -1302,7 +1301,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); final String fileName = getPath("InputValidCommaIndent.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -1354,7 +1353,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "8"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputInvalidThrowsIndent.java"), expected); } @@ -1438,7 +1437,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputValidAssignIndent.java"), expected); } @@ -1454,7 +1453,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("Input15Extensions.java"), expected); } @@ -1470,7 +1469,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputValidTryResourcesIndent.java"), expected); } @@ -1487,7 +1486,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "8"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "8"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputSwitchCustom.java"), expected); } @@ -1503,7 +1502,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "8"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "8"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputSynchronizedStatement.java"), expected); } @@ -1518,7 +1517,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("lineWrappingIndentation", "8"); checkConfig.addAttribute("tabWidth", "4"); checkConfig.addAttribute("throwsIndent", "8"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputSynchronizedMethod.java"), expected); } @@ -1547,7 +1546,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { public void testAnnotationDefinition() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); checkConfig.addAttribute("tabWidth", "4"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, getPath("InputAnnotationDefinition.java"), expected); } @@ -1597,7 +1596,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); checkConfig.addAttribute("tabWidth", "4"); final String fileName = getPath("InputSeparatedStatements.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verifyWarns(checkConfig, fileName, expected); } @@ -1606,7 +1605,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); checkConfig.addAttribute("tabWidth", "4"); final String fileName = getPath("InputSeparatedStatementWithSpaces.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, fileName, 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 02f6df490..b7593b885 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 @@ -22,11 +22,11 @@ package com.puppycrawl.tools.checkstyle.checks.indentation; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Unit test for IndentationCheck. @@ -42,7 +42,7 @@ public class NewHandlerTest extends BaseCheckTestSupport { @Test public void testInvalidLabel() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputNewHandler.java"), 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 ec5fac95b..6ebd8c332 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 @@ -32,7 +32,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -45,6 +44,7 @@ import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.internal.TestUtils; import com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AbstractJavadocCheckTest extends BaseCheckTestSupport { @Override @@ -67,7 +67,7 @@ public class AbstractJavadocCheckTest extends BaseCheckTestSupport { @Test public void testCustomTag() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(TempCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCustomTag.java"), expected); } @@ -136,7 +136,7 @@ public class AbstractJavadocCheckTest extends BaseCheckTestSupport { throws Exception { JavadocCatchCheck.clearCounter(); final DefaultConfiguration checkConfig = createCheckConfig(JavadocCatchCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputJavadocPosition.java"), expected); Assert.assertEquals(58, JavadocCatchCheck.javadocsNumber); } @@ -146,7 +146,7 @@ public class AbstractJavadocCheckTest extends BaseCheckTestSupport { throws Exception { JavadocCatchCheck.clearCounter(); final DefaultConfiguration checkConfig = createCheckConfig(JavadocCatchCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputJavadocPositionWithSinglelineComments.java"), expected); Assert.assertEquals(58, JavadocCatchCheck.javadocsNumber); } @@ -156,7 +156,7 @@ public class AbstractJavadocCheckTest extends BaseCheckTestSupport { throws Exception { JavadocCatchCheck.clearCounter(); final DefaultConfiguration checkConfig = createCheckConfig(JavadocCatchCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputJavadocPositionOnlyComments.java"), expected); Assert.assertEquals(0, JavadocCatchCheck.javadocsNumber); } @@ -170,7 +170,7 @@ public class AbstractJavadocCheckTest extends BaseCheckTestSupport { @Override public int[] getDefaultJavadocTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractTypeAwareCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractTypeAwareCheckTest.java index 2a12e6827..e5c45dcf1 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractTypeAwareCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractTypeAwareCheckTest.java @@ -31,7 +31,6 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; @@ -39,6 +38,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; @SuppressWarnings("deprecation") public class AbstractTypeAwareCheckTest extends BaseCheckTestSupport { @@ -177,7 +177,7 @@ public class AbstractTypeAwareCheckTest extends BaseCheckTestSupport { public void testWithSuppressLoadErrors() throws Exception { checkConfig.addAttribute("suppressLoadErrors", "true"); checkConfig.addAttribute("allowUndeclaredRTE", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputLoadErrors.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 1e9b62945..3e36c062b 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AtclauseOrderCheckTest extends BaseCheckTestSupport { @Override @@ -56,7 +56,7 @@ public class AtclauseOrderCheckTest extends BaseCheckTestSupport { @Test public void testCorrect() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(AtclauseOrderCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCorrectAtClauseOrder.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 60f6306f1..4bf0e89c6 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 @@ -32,7 +32,6 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; @@ -40,6 +39,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.Scope; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class JavadocMethodCheckTest extends BaseCheckTestSupport { private DefaultConfiguration checkConfig; @@ -112,7 +112,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { final DefaultConfiguration config = createCheckConfig(JavadocMethodCheck.class); config.addAttribute("allowedAnnotations", "Override,ThisIsOk, \t\n\t ThisIsOkToo"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(config, getPath("InputAllowedAnnotations.java"), expected); } @@ -210,7 +210,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { @Test public void testNoJavadoc() throws Exception { checkConfig.addAttribute("scope", Scope.NOTHING.getName()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputPublicOnly.java"), expected); } @@ -240,7 +240,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { @Test public void testScopeAnonInnerPrivate() throws Exception { checkConfig.addAttribute("scope", Scope.PRIVATE.getName()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputScopeAnonInner.java"), expected); } @@ -257,7 +257,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { @Test public void testScopeAnonInnerWithResolver() throws Exception { checkConfig.addAttribute("allowUndeclaredRTE", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputScopeAnonInner.java"), expected); } @@ -387,7 +387,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { @Test public void testAllowMissingJavadoc() throws Exception { checkConfig.addAttribute("allowMissingJavadoc", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputNoJavadoc.java"), expected); } @@ -396,7 +396,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("allowMissingParamTags", "true"); checkConfig.addAttribute("allowMissingThrowsTags", "true"); checkConfig.addAttribute("allowMissingReturnTag", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputMissingJavadocTags.java"), expected); } @@ -472,13 +472,13 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { @Test public void test11684081() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("Input_01.java"), expected); } @Test public void test11684082() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("Input_02.java"), expected); } @@ -486,7 +486,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { public void test11684083() throws Exception { checkConfig.addAttribute("allowThrowsTagsForSubclasses", "true"); checkConfig.addAttribute("allowUndeclaredRTE", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("Input_03.java"), expected); } @@ -537,7 +537,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { public void test1379666() throws Exception { checkConfig.addAttribute("allowThrowsTagsForSubclasses", "true"); checkConfig.addAttribute("allowUndeclaredRTE", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("Input_1379666.java"), expected); } @@ -557,7 +557,7 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport { @Test public void testSkipCertainMethods() throws Exception { checkConfig.addAttribute("ignoreMethodNamesRegex", "^foo.*$"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputJavadocMethodIgnoreNameRegex.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 e18f318f4..c59daafd2 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 @@ -25,12 +25,12 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.Configuration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class JavadocPackageCheckTest extends BaseCheckTestSupport { @@ -116,7 +116,7 @@ public class JavadocPackageCheckTest public void testHtmlAllowed() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocPackageCheck.class); checkConfig.addAttribute("allowLegacy", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(createChecker(checkConfig), getPath("pkghtml" + File.separator + "InputIgnored.java"), getPath("pkghtml" + File.separator + "package-info.java"), expected); @@ -125,7 +125,7 @@ public class JavadocPackageCheckTest @Test public void testAnnotation() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocPackageCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(createChecker(checkConfig), getPath("pkginfo" + File.separator + "annotation" + File.separator + "package-info.java"), 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 a72e2939d..7c89f6982 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 @@ -28,13 +28,13 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class JavadocParagraphCheckTest extends BaseCheckTestSupport { private DefaultConfiguration checkConfig; @@ -59,7 +59,7 @@ public class JavadocParagraphCheckTest extends BaseCheckTestSupport { @Test public void testCorrect() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCorrectJavaDocParagraph.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 40b3ed2c0..b8b0c9f52 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 @@ -30,12 +30,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class JavadocStyleCheckTest extends BaseCheckTestSupport { @@ -188,7 +188,7 @@ public class JavadocStyleCheckTest final DefaultConfiguration checkConfig = createCheckConfig(JavadocStyleCheck.class); checkConfig.addAttribute("checkFirstSentence", "false"); checkConfig.addAttribute("checkHtml", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputJavadocStyleHtmlComment.java"), expected); } @@ -196,7 +196,7 @@ public class JavadocStyleCheckTest @Test public void testOnInputWithNoJavadoc() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocStyleCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputNoJavadoc.java"), expected); } @@ -366,7 +366,7 @@ public class JavadocStyleCheckTest public void packageInfoAnnotation() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocStyleCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(createChecker(checkConfig), getPath("pkginfo" + File.separator + "annotation" + File.separator @@ -391,7 +391,7 @@ public class JavadocStyleCheckTest public void packageInfoValid() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocStyleCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(createChecker(checkConfig), getPath("pkginfo" + File.separator + "valid" + File.separator + "package-info.java"), 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 7ec720b12..ce368fd08 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class JavadocTagContinuationIndentationCheckTest extends BaseCheckTestSupport { @@ -52,7 +52,7 @@ public class JavadocTagContinuationIndentationCheckTest public void testFp() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavadocTagContinuationIndentationCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGuavaFalsePositive.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 1d8b9a5da..ca81756dc 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 @@ -29,13 +29,13 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.Scope; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * @author Oliver.Burn @@ -50,7 +50,7 @@ public class JavadocTypeCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final JavadocTypeCheck javadocTypeCheck = new JavadocTypeCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, javadocTypeCheck.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, javadocTypeCheck.getRequiredTokens()); } @Test @@ -388,7 +388,7 @@ public class JavadocTypeCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(JavadocTypeCheck.class); checkConfig.addAttribute("allowUnknownTags", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 5ea4c8dbe..839a814f7 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 @@ -25,13 +25,13 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.Scope; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class JavadocVariableCheckTest extends BaseCheckTestSupport { @@ -97,7 +97,7 @@ public class JavadocVariableCheckTest final DefaultConfiguration checkConfig = createCheckConfig(JavadocVariableCheck.class); checkConfig.addAttribute("scope", Scope.PUBLIC.getName()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 529d7e521..146fd067d 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 @@ -26,13 +26,13 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class SummaryJavadocCheckTest extends BaseCheckTestSupport { private DefaultConfiguration checkConfig; @@ -59,7 +59,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCorrectSummaryJavaDoc.java"), expected); } @@ -94,7 +94,7 @@ public class SummaryJavadocCheckTest extends BaseCheckTestSupport { @Test public void testNoPeriod() throws Exception { checkConfig.addAttribute("period", ""); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSummaryJavadocNoPeriod.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 35707fb05..f7d64c3eb 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 @@ -34,7 +34,6 @@ import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.List; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; @@ -42,6 +41,7 @@ import com.google.common.collect.Lists; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Unit test for WriteTagCheck. @@ -63,7 +63,7 @@ public class WriteTagCheckTest extends BaseCheckTestSupport { @Test public void testDefaultSettings() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputWriteTag.java"), expected); } @@ -157,7 +157,7 @@ public class WriteTagCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("tag", "@todo2"); checkConfig.addAttribute("tagFormat", "\\S"); checkConfig.addAttribute("severity", "ignore"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputWriteTag.java"), expected); } @@ -166,7 +166,7 @@ public class WriteTagCheckTest extends BaseCheckTestSupport { throws Exception { checkConfig.addAttribute("tag", "@author"); checkConfig.addAttribute("tagFormat", "0*"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputWriteTag.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheckTest.java index 8e501e883..2cd5ad65f 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheckTest.java @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.metrics.BooleanExpressionCo import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import antlr.CommonHiddenStreamToken; @@ -33,6 +32,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class BooleanExpressionComplexityCheckTest extends BaseCheckTestSupport { @Override @@ -63,7 +63,7 @@ public class BooleanExpressionComplexityCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("max", "5"); checkConfig.addAttribute("tokens", "BXOR,LAND,LOR"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputBooleanExpressionComplexity.java"), expected); } @@ -73,7 +73,7 @@ public class BooleanExpressionComplexityCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(BooleanExpressionComplexityCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputBooleanExpressionComplexityNPE.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java index 5161de166..7b5871d3b 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.metrics.ClassDataAbstractio import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import antlr.CommonHiddenStreamToken; @@ -33,6 +32,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ClassDataAbstractionCouplingCheckTest extends BaseCheckTestSupport { @Override @@ -62,9 +62,9 @@ public class ClassDataAbstractionCouplingCheckTest extends BaseCheckTestSupport public void testDefaultConfiguration() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ClassDataAbstractionCouplingCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputClassCoupling.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java index 5fef1aa40..a025f834a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java @@ -24,13 +24,13 @@ import static com.puppycrawl.tools.checkstyle.checks.metrics.ClassFanOutComplexi import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ClassFanOutComplexityCheckTest extends BaseCheckTestSupport { @Override @@ -61,7 +61,7 @@ public class ClassFanOutComplexityCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("max", "0"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("Input15Extensions.java"), expected); } @@ -70,9 +70,9 @@ public class ClassFanOutComplexityCheckTest extends BaseCheckTestSupport { public void testDefaultConfiguration() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ClassFanOutComplexityCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputClassCoupling.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheckTest.java index 759be213f..a98aba90a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheckTest.java @@ -24,13 +24,13 @@ import static com.puppycrawl.tools.checkstyle.checks.metrics.CyclomaticComplexit import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class CyclomaticComplexityCheckTest extends BaseCheckTestSupport { @@ -120,7 +120,7 @@ public class CyclomaticComplexityCheckTest final DefaultConfiguration checkConfig = createCheckConfig(CyclomaticComplexityCheck.class); checkConfig.addAttribute("max", "100"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputComplexitySwitchBlocks.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java index c2c71f21b..44ebc3f93 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java @@ -26,13 +26,13 @@ import static com.puppycrawl.tools.checkstyle.checks.metrics.JavaNCSSCheck.MSG_M import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Test case for the JavaNCSS-Check. @@ -76,9 +76,9 @@ public class JavaNCSSCheckTest extends BaseCheckTestSupport { @Test public void testDefaultConfiguration() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(JavaNCSSCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputJavaNCSS.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheckTest.java index d0aa8d7b9..9437f33bc 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheckTest.java @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.metrics.NPathComplexityChec import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -34,6 +33,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class NPathComplexityCheckTest extends BaseCheckTestSupport { @Override @@ -84,9 +84,9 @@ public class NPathComplexityCheckTest extends BaseCheckTestSupport { public void testDefaultConfiguration() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NPathComplexityCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputComplexity.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 b8e39634b..ec6be33f4 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 @@ -26,13 +26,13 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ModifierOrderCheckTest extends BaseCheckTestSupport { @@ -75,7 +75,7 @@ public class ModifierOrderCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ModifierOrderCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputModifier2.java"), expected); } @@ -84,12 +84,12 @@ public class ModifierOrderCheckTest final ModifierOrderCheck modifierOrderCheckObj = new ModifierOrderCheck(); final int[] actual = modifierOrderCheckObj.getDefaultTokens(); final int[] expected = {TokenTypes.MODIFIERS}; - final int[] unexpectedEmptyArray = ArrayUtils.EMPTY_INT_ARRAY; final int[] unexpectedArray = { TokenTypes.MODIFIERS, TokenTypes.OBJBLOCK, }; assertArrayEquals(expected, actual); + final int[] unexpectedEmptyArray = CommonUtils.EMPTY_INT_ARRAY; Assert.assertNotSame(unexpectedEmptyArray, actual); Assert.assertNotSame(unexpectedArray, actual); Assert.assertNotNull(actual); @@ -100,12 +100,12 @@ public class ModifierOrderCheckTest final ModifierOrderCheck modifierOrderCheckObj = new ModifierOrderCheck(); final int[] actual = modifierOrderCheckObj.getAcceptableTokens(); final int[] expected = {TokenTypes.MODIFIERS}; - final int[] unexpectedEmptyArray = ArrayUtils.EMPTY_INT_ARRAY; final int[] unexpectedArray = { TokenTypes.MODIFIERS, TokenTypes.OBJBLOCK, }; assertArrayEquals(expected, actual); + final int[] unexpectedEmptyArray = CommonUtils.EMPTY_INT_ARRAY; Assert.assertNotSame(unexpectedEmptyArray, actual); Assert.assertNotSame(unexpectedArray, actual); Assert.assertNotNull(actual); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheckTest.java index 15679183a..18561d56d 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheckTest.java @@ -24,13 +24,13 @@ import static com.puppycrawl.tools.checkstyle.checks.modifier.RedundantModifierC import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RedundantModifierCheckTest extends BaseCheckTestSupport { @@ -87,7 +87,7 @@ public class RedundantModifierCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RedundantModifierCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputStaticModifierInInterface.java"), expected); } @@ -172,7 +172,7 @@ public class RedundantModifierCheckTest public void testGetRequiredTokens() { final RedundantModifierCheck redundantModifierCheckObj = new RedundantModifierCheck(); final int[] actual = redundantModifierCheckObj.getRequiredTokens(); - final int[] expected = ArrayUtils.EMPTY_INT_ARRAY; + final int[] expected = CommonUtils.EMPTY_INT_ARRAY; Assert.assertArrayEquals(expected, actual); } 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 db3f0a99b..1d913d3a7 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 @@ -24,11 +24,11 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordIn import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AbbreviationAsWordInNameCheckTest extends BaseCheckTestSupport { @@ -311,7 +311,7 @@ public class AbbreviationAsWordInNameCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("ignoreFinal", "false"); checkConfig.addAttribute("allowedAbbreviations", null); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputAbstractMultisetSetCount.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheckTest.java index 325c98484..723671f37 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheckTest.java @@ -25,13 +25,13 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class CatchParameterNameCheckTest extends BaseCheckTestSupport { @Override @@ -51,7 +51,7 @@ public class CatchParameterNameCheckTest extends BaseCheckTestSupport { @Test public void testDefaultConfigurationOnCorrectFile() throws Exception { final Configuration checkConfig = createCheckConfig(CatchParameterNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSimple.java"), expected); } @@ -95,7 +95,7 @@ public class CatchParameterNameCheckTest extends BaseCheckTestSupport { final String format = "[a-z]"; checkConfig.addAttribute("format", format); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCatchParameterName.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 590640eec..c7db03a9b 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 @@ -27,7 +27,6 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -35,6 +34,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ConstantNameCheckTest extends BaseCheckTestSupport { @@ -128,7 +128,7 @@ public class ConstantNameCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ConstantNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputConstantNames.java"), expected); } @@ -157,7 +157,7 @@ public class ConstantNameCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ConstantNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputStaticModifierInInterface.java"), expected); } 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 dd7be5727..9e7fe5446 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class LocalFinalVariableNameCheckTest extends BaseCheckTestSupport { @@ -44,7 +44,7 @@ public class LocalFinalVariableNameCheckTest public void testGetRequiredTokens() { final LocalFinalVariableNameCheck checkObj = new LocalFinalVariableNameCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -81,7 +81,7 @@ public class LocalFinalVariableNameCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(LocalFinalVariableNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 b6226f4bb..aa4f99c3b 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 @@ -24,11 +24,11 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class LocalVariableNameCheckTest extends BaseCheckTestSupport { @@ -60,7 +60,7 @@ public class LocalVariableNameCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(LocalVariableNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 b8a01b533..2b25bc3a4 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 @@ -26,12 +26,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MethodNameCheckTest extends BaseCheckTestSupport { @@ -142,7 +142,7 @@ public class MethodNameCheckTest final DefaultConfiguration checkConfig = createCheckConfig(MethodNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 cb8f815e5..cf5138ecd 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class PackageNameCheckTest extends BaseCheckTestSupport { @@ -68,7 +68,7 @@ public class PackageNameCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(PackageNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 f4aba6bc0..1abc728e7 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ParameterNameCheckTest extends BaseCheckTestSupport { @@ -53,7 +53,7 @@ public class ParameterNameCheckTest final DefaultConfiguration checkConfig = createCheckConfig(ParameterNameCheck.class); checkConfig.addAttribute("format", "^NO_WAY_MATEY$"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputCatchOnly.java"), expected); } @@ -79,7 +79,7 @@ public class ParameterNameCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ParameterNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSimple.java"), expected); } @@ -144,7 +144,7 @@ public class ParameterNameCheckTest final DefaultConfiguration checkConfig = createCheckConfig(ParameterNameCheck.class); checkConfig.addAttribute("format", "^[a-z][a-zA-Z0-9]*$"); checkConfig.addAttribute("ignoreOverridden", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOverrideAnnotationNoNPE.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 e4eaa41ad..27e851849 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class StaticVariableNameCheckTest extends BaseCheckTestSupport { @@ -72,7 +72,7 @@ public class StaticVariableNameCheckTest // allow method names and class names to equal checkConfig.addAttribute("applyToPrivate", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSimple.java"), expected); } @@ -81,7 +81,7 @@ public class StaticVariableNameCheckTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(StaticVariableNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputStaticVariableName.java"), expected); } 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 14d0402fd..7bcd91e75 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,12 +25,12 @@ 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; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import com.puppycrawl.tools.checkstyle.utils.TokenUtils; public class TypeNameCheckTest @@ -47,7 +47,7 @@ public class TypeNameCheckTest final DefaultConfiguration checkConfig = createCheckConfig(TypeNameCheck.class); checkConfig.addAttribute("format", "^inputHe"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTypeName.java"), 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 4cdc23950..0d251417e 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 @@ -27,11 +27,11 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RegexpCheckTest extends BaseCheckTestSupport { @Override @@ -43,7 +43,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final RegexpCheck checkObj = new RegexpCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -52,7 +52,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpCheck.class); checkConfig.addAttribute("format", required); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -75,7 +75,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { createCheckConfig(RegexpCheck.class); checkConfig.addAttribute("format", required); checkConfig.addAttribute("duplicateLimit", "0"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -85,7 +85,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpCheck.class); checkConfig.addAttribute("format", required); checkConfig.addAttribute("duplicateLimit", "-1"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -109,7 +109,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { createCheckConfig(RegexpCheck.class); checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("illegalPattern", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -208,7 +208,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { createCheckConfig(RegexpCheck.class); checkConfigFalse.addAttribute("format", illegalFalse); checkConfigFalse.addAttribute("illegalPattern", "true"); - final String[] expectedFalse = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expectedFalse = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfigFalse, getPath("InputSemantic.java"), expectedFalse); } @@ -221,7 +221,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -249,7 +249,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -276,7 +276,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -288,7 +288,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -300,7 +300,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -341,14 +341,14 @@ public class RegexpCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @Test public void testOnFileStartingWithEmptyLine() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 ed4ec161d..db386ebd0 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 @@ -27,7 +27,6 @@ import static com.puppycrawl.tools.checkstyle.checks.regexp.MultilineDetector.MS import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -37,6 +36,7 @@ import com.google.common.base.Charsets; import com.google.common.io.Files; import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport { @Rule @@ -94,7 +94,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -128,7 +128,7 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport { @Test public void testDefaultConfiguration() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -202,7 +202,7 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport { final String illegal = "^import"; checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("maximum", "5000"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheckTest.java index c59f790fb..9efa0066a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheckTest.java @@ -27,12 +27,12 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { @Override @@ -43,7 +43,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { @Test public void testDefaultConfigurationOnValidInput() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpOnFilenameCheck.class); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -73,7 +73,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpOnFilenameCheck.class); checkConfig.addAttribute("match", "true"); checkConfig.addAttribute("fileNamePattern", "BAD.*"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -93,7 +93,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpOnFilenameCheck.class); checkConfig.addAttribute("match", "false"); checkConfig.addAttribute("fileNamePattern", ".*\\.java"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -113,7 +113,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpOnFilenameCheck.class); checkConfig.addAttribute("match", "true"); checkConfig.addAttribute("folderPattern", "BAD.*"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -133,7 +133,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpOnFilenameCheck.class); checkConfig.addAttribute("match", "false"); checkConfig.addAttribute("folderPattern", ".*[\\\\/]resources[\\\\/].*"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -155,7 +155,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { checkConfig.addAttribute("match", "true"); checkConfig.addAttribute("folderPattern", "BAD.*"); checkConfig.addAttribute("fileNamePattern", ".*\\.properties"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -164,7 +164,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { checkConfig.addAttribute("match", "true"); checkConfig.addAttribute("folderPattern", ".*[\\\\/]resources[\\\\/].*"); checkConfig.addAttribute("fileNamePattern", ".*\\.properties"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -173,7 +173,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { checkConfig.addAttribute("match", "true"); checkConfig.addAttribute("folderPattern", "BAD.*"); checkConfig.addAttribute("fileNamePattern", ".*\\.java"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -195,7 +195,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { checkConfig.addAttribute("match", "false"); checkConfig.addAttribute("folderPattern", ".*[\\\\/]javastrangefolder[\\\\/].*"); checkConfig.addAttribute("fileNamePattern", ".*\\.dat"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -204,7 +204,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { checkConfig.addAttribute("match", "false"); checkConfig.addAttribute("folderPattern", ".*[\\\\/]govstrangefolder[\\\\/].*"); checkConfig.addAttribute("fileNamePattern", ".*\\.java"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -212,7 +212,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpOnFilenameCheck.class); checkConfig.addAttribute("fileNamePattern", ".*\\.java"); checkConfig.addAttribute("ignoreFileNameExtensions", "true"); - verify(checkConfig, getPath("InputSemantic.java"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputSemantic.java"), CommonUtils.EMPTY_STRING_ARRAY); } @Test @@ -220,7 +220,7 @@ public class RegexpOnFilenameCheckTest extends BaseFileSetCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(RegexpOnFilenameCheck.class); checkConfig.addAttribute("fileNamePattern", "\\."); checkConfig.addAttribute("ignoreFileNameExtensions", "true"); - verify(checkConfig, getPath("InputNoExtension"), ArrayUtils.EMPTY_STRING_ARRAY); + verify(checkConfig, getPath("InputNoExtension"), CommonUtils.EMPTY_STRING_ARRAY); } @Test 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 83773243c..695649818 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 @@ -25,12 +25,12 @@ import static com.puppycrawl.tools.checkstyle.checks.regexp.MultilineDetector.MS import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RegexpSinglelineCheckTest extends BaseFileSetCheckTestSupport { private DefaultConfiguration checkConfig; @@ -87,7 +87,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 518b34031..81f267a8a 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 @@ -26,12 +26,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { private DefaultConfiguration checkConfig; @@ -50,7 +50,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final RegexpSinglelineJavaCheck checkObj = new RegexpSinglelineJavaCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -92,7 +92,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -102,7 +102,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -124,7 +124,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { final String illegal = "c-style 1"; checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -145,7 +145,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { final String illegal = "c-style 2"; checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -154,7 +154,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 = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -163,7 +163,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { final String illegal = "long ms /"; checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -195,7 +195,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { final String illegal = "long ms "; checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -205,7 +205,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { final String illegal = "\\s+$"; checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("ignoreComments", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @@ -215,7 +215,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("format", required); checkConfig.addAttribute("minimum", "1"); checkConfig.addAttribute("maximum", "1000"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -225,7 +225,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport { checkConfig.addAttribute("format", required); checkConfig.addAttribute("minimum", "1"); checkConfig.addAttribute("maximum", "1000"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSemantic.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java index 9f89fadc2..1371e6cd4 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java @@ -24,7 +24,6 @@ import static com.puppycrawl.tools.checkstyle.checks.sizes.ExecutableStatementCo import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import antlr.CommonHiddenStreamToken; @@ -33,6 +32,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ExecutableStatementCountCheckTest extends BaseCheckTestSupport { @@ -155,9 +155,9 @@ public class ExecutableStatementCountCheckTest public void testDefaultConfiguration() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ExecutableStatementCountCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; createChecker(checkConfig); + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputExecutableStatementCount.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 ec8958ee6..70bf203c7 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 @@ -26,13 +26,13 @@ import static org.junit.Assert.fail; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class FileLengthCheckTest extends BaseCheckTestSupport { @@ -68,7 +68,7 @@ public class FileLengthCheckTest final DefaultConfiguration checkConfig = createCheckConfig(FileLengthCheck.class); checkConfig.addAttribute("max", "2000"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(createChecker(checkConfig), getPath("InputSimple.java"), getPath("InputSimple.java"), expected); @@ -98,7 +98,7 @@ public class FileLengthCheckTest final DefaultConfiguration checkConfig = createCheckConfig(FileLengthCheck.class); checkConfig.addAttribute("fileExtensions", "txt"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(createChecker(checkConfig), getPath("InputSimple.java"), diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheckTest.java index afca19e76..945075f31 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheckTest.java @@ -25,11 +25,11 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class LineLengthCheckTest extends BaseCheckTestSupport { @Override @@ -47,13 +47,13 @@ public class LineLengthCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final LineLengthCheck checkObj = new LineLengthCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test public void testGetAcceptableTokens() { final LineLengthCheck checkObj = new LineLengthCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getAcceptableTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getAcceptableTokens()); } @Test 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 0ba616134..2ec1e5353 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 @@ -29,12 +29,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MethodCountCheckTest extends BaseCheckTestSupport { @Override @@ -71,7 +71,7 @@ public class MethodCountCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(MethodCountCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputMethodCount.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 61f8b84a8..2863f9042 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MethodLengthCheckTest extends BaseCheckTestSupport { @Override @@ -42,7 +42,7 @@ public class MethodLengthCheckTest extends BaseCheckTestSupport { @Test public void testGetRequiredTokens() { final MethodLengthCheck checkObj = new MethodLengthCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -75,7 +75,7 @@ public class MethodLengthCheckTest extends BaseCheckTestSupport { createCheckConfig(MethodLengthCheck.class); checkConfig.addAttribute("max", "19"); checkConfig.addAttribute("countEmpty", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSimple.java"), expected); } @@ -83,7 +83,7 @@ public class MethodLengthCheckTest extends BaseCheckTestSupport { public void testAbstract() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MethodLengthCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.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 25da97d48..c154842d6 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 @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class OuterTypeNumberCheckTest extends BaseCheckTestSupport { @Override @@ -80,7 +80,7 @@ public class OuterTypeNumberCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeNumberCheck.class); checkConfig.addAttribute("max", "30"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSimple.java"), expected); } @@ -89,7 +89,7 @@ public class OuterTypeNumberCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeNumberCheck.class); checkConfig.addAttribute("max", "1"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOuterTypeNumber.java"), expected); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java index 585301733..dc3a20241 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java @@ -25,12 +25,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ParameterNumberCheckTest extends BaseCheckTestSupport { @@ -43,7 +43,7 @@ public class ParameterNumberCheckTest @Test public void testGetRequiredTokens() { final ParameterNumberCheck checkObj = new ParameterNumberCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java index b125e201c..e35381164 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java @@ -27,7 +27,6 @@ import static org.junit.Assert.assertEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; @@ -35,6 +34,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class EmptyForInitializerPadCheckTest extends BaseCheckTestSupport { @@ -109,7 +109,7 @@ public class EmptyForInitializerPadCheckTest @Test(expected = CheckstyleException.class) public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputForWhitespace.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java index 18957c0cd..d7484ee0d 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java @@ -26,7 +26,6 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; @@ -34,6 +33,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class EmptyForIteratorPadCheckTest extends BaseCheckTestSupport { @@ -89,7 +89,7 @@ public class EmptyForIteratorPadCheckTest @Test(expected = CheckstyleException.class) public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputForWhitespace.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 86e75fa77..c2ed6cf95 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 @@ -27,12 +27,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class EmptyLineSeparatorCheckTest extends BaseCheckTestSupport { @@ -45,7 +45,7 @@ public class EmptyLineSeparatorCheckTest @Test public void testGetRequiredTokens() { final EmptyLineSeparatorCheck checkObj = new EmptyLineSeparatorCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -114,7 +114,7 @@ public class EmptyLineSeparatorCheckTest public void testFormerArrayIndexOutOfBounds() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(EmptyLineSeparatorCheck.class); checkConfig.addAttribute("allowMultipleEmptyLines", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputEmptyLineSeparatorFormerException.java"), expected); } @@ -123,7 +123,7 @@ public class EmptyLineSeparatorCheckTest final DefaultConfiguration checkConfig = createCheckConfig(EmptyLineSeparatorCheck.class); checkConfig.addAttribute("allowMultipleEmptyLines", "false"); checkConfig.addAttribute("allowNoEmptyLineBetweenFields", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputEmptyLineSeparatorMultipleFieldsInClass.java"), expected); } @@ -161,7 +161,7 @@ public class EmptyLineSeparatorCheckTest public void testPrePreviousLineEmptiness() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(EmptyLineSeparatorCheck.class); checkConfig.addAttribute("allowMultipleEmptyLines", "false"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 470134d99..fadb35f47 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 @@ -29,7 +29,6 @@ import java.io.File; import java.io.IOException; import java.util.Map; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; @@ -40,6 +39,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class GenericWhitespaceCheckTest extends BaseCheckTestSupport { @@ -112,19 +112,19 @@ public class GenericWhitespaceCheckTest @Test public void testGh47() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGh47.java"), expected); } @Test public void testInnerClass() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGenericWhitespaceInnerClass.java"), expected); } @Test public void testMethodReferences() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputMethodReferences3.java"), expected); } @@ -138,7 +138,7 @@ public class GenericWhitespaceCheckTest @Test public void testGenericEndsTheLine() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputGenericWhitespaceEndsTheLine.java"), 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 7e400ec34..4000b46f1 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 @@ -27,7 +27,6 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; @@ -35,6 +34,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MethodParamPadCheckTest extends BaseCheckTestSupport { @@ -54,7 +54,7 @@ public class MethodParamPadCheckTest @Test public void testGetRequiredTokens() { final MethodParamPadCheck checkObj = new MethodParamPadCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -132,7 +132,7 @@ public class MethodParamPadCheckTest @Test public void test1322879() throws Exception { checkConfig.addAttribute("option", PadOption.SPACE.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputWhitespaceAround.java"), expected); } @@ -155,7 +155,7 @@ public class MethodParamPadCheckTest @Test(expected = CheckstyleException.class) public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputMethodParamPad.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 0c1641eea..d4819361e 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 @@ -24,11 +24,11 @@ import static com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck. import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class NoLineWrapCheckTest extends BaseCheckTestSupport { @@ -41,7 +41,7 @@ public class NoLineWrapCheckTest @Test public void testCaseWithoutLineWrapping() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NoLineWrapCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputNoLineWrapGood.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java index e572bfaa2..9caaa82ae 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java @@ -25,13 +25,13 @@ import static com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapChec import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class OperatorWrapCheckTest extends BaseCheckTestSupport { @@ -87,7 +87,7 @@ public class OperatorWrapCheckTest @Test(expected = CheckstyleException.class) public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputOpWrap.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 ad053b219..3c032989c 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 @@ -27,12 +27,12 @@ import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPad import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class ParenPadCheckTest extends BaseCheckTestSupport { @@ -147,7 +147,7 @@ public class ParenPadCheckTest final DefaultConfiguration checkConfig = createCheckConfig(ParenPadCheck.class); checkConfig.addAttribute("option", PadOption.SPACE.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputParenPadWithSpace.java"), expected); } @@ -245,7 +245,7 @@ public class ParenPadCheckTest public void testInvalidOption() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(ParenPadCheck.class); checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputParenPad.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheckTest.java index 291591cf3..b7b85e4b0 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheckTest.java @@ -25,7 +25,6 @@ import static com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapChe import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -34,6 +33,7 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class SeparatorWrapCheckTest extends BaseCheckTestSupport { @@ -85,7 +85,7 @@ public class SeparatorWrapCheckTest @Test(expected = CheckstyleException.class) public void testInvalidOption() throws Exception { checkConfig.addAttribute("option", "invalid_option"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputSeparatorWrap.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 df960d4bb..03cf24622 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 @@ -27,13 +27,13 @@ import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPad import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class TypecastParenPadCheckTest extends BaseCheckTestSupport { @@ -79,7 +79,7 @@ public class TypecastParenPadCheckTest final DefaultConfiguration checkConfig = createCheckConfig(TypecastParenPadCheck.class); checkConfig.addAttribute("option", PadOption.SPACE.toString()); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 fe0d708ea..cd65f0007 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 @@ -26,12 +26,12 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class WhitespaceAfterCheckTest extends BaseCheckTestSupport { @@ -51,7 +51,7 @@ public class WhitespaceAfterCheckTest @Test public void testGetRequiredTokens() { final WhitespaceAfterCheck checkObj = new WhitespaceAfterCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -102,7 +102,7 @@ public class WhitespaceAfterCheckTest @Test public void test1322879() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputWhitespaceAround.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java index f5306d773..8cdade647 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java @@ -26,13 +26,13 @@ import static org.junit.Assert.assertArrayEquals; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Before; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class WhitespaceAroundCheckTest extends BaseCheckTestSupport { @@ -58,7 +58,7 @@ public class WhitespaceAroundCheckTest @Test public void testGetRequiredTokens() { final WhitespaceAroundCheck checkObj = new WhitespaceAroundCheck(); - assertArrayEquals(ArrayUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); + assertArrayEquals(CommonUtils.EMPTY_INT_ARRAY, checkObj.getRequiredTokens()); } @Test @@ -159,7 +159,7 @@ public class WhitespaceAroundCheckTest @Test public void test1322879And1649038() throws Exception { - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputWhitespaceAround.java"), expected); } @@ -241,7 +241,7 @@ public class WhitespaceAroundCheckTest @Test public void allowEmptyMethods() throws Exception { checkConfig.addAttribute("allowEmptyMethods", "true"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputWhitespaceAround.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWarningsFilterTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWarningsFilterTest.java index 5edac9118..1befbbb46 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWarningsFilterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWarningsFilterTest.java @@ -25,7 +25,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Locale; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.google.common.collect.Lists; @@ -42,6 +41,7 @@ import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck; import com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; import com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class SuppressWarningsFilterTest extends BaseCheckTestSupport { @@ -78,7 +78,7 @@ public class SuppressWarningsFilterTest @Test public void testNone() throws Exception { final DefaultConfiguration filterConfig = null; - final String[] suppressed = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] suppressed = CommonUtils.EMPTY_STRING_ARRAY; verifySuppressed(filterConfig, suppressed); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java index d22c5685e..e60663c52 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java @@ -28,7 +28,6 @@ import java.util.Collection; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -47,6 +46,7 @@ import com.puppycrawl.tools.checkstyle.checks.FileContentsHolder; import com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck; import com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import nl.jqno.equalsverifier.EqualsVerifier; @@ -89,7 +89,7 @@ public class SuppressWithNearbyCommentFilterTest @Test public void testNone() throws Exception { final DefaultConfiguration filterConfig = null; - final String[] suppressed = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] suppressed = CommonUtils.EMPTY_STRING_ARRAY; verifySuppressed(filterConfig, suppressed); } @@ -251,9 +251,9 @@ public class SuppressWithNearbyCommentFilterTest final DefaultConfiguration filterConfig = createFilterConfig(SuppressWithNearbyCommentFilter.class); filterConfig.addAttribute("influenceFormat", "a"); - final String[] suppressed = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] suppressed = CommonUtils.EMPTY_STRING_ARRAY; verifySuppressed(filterConfig, suppressed); } catch (CheckstyleException ex) { @@ -269,9 +269,9 @@ public class SuppressWithNearbyCommentFilterTest final DefaultConfiguration filterConfig = createFilterConfig(SuppressWithNearbyCommentFilter.class); filterConfig.addAttribute("checkFormat", "a[l"); - final String[] suppressed = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] suppressed = CommonUtils.EMPTY_STRING_ARRAY; verifySuppressed(filterConfig, suppressed); } catch (CheckstyleException ex) { @@ -313,7 +313,7 @@ public class SuppressWithNearbyCommentFilterTest filterConfig.addAttribute("commentFormat", "SUPPRESS CHECKSTYLE (\\w+)"); filterConfig.addAttribute("checkFormat", "IllegalCatchCheck"); filterConfig.addAttribute("messageFormat", "^$1 ololo*$"); - final String[] suppressed = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] suppressed = CommonUtils.EMPTY_STRING_ARRAY; verifySuppressed(filterConfig, suppressed); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java index 75bb32265..be09f4dea 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java @@ -28,7 +28,6 @@ import java.util.Collection; import java.util.Locale; import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -47,6 +46,7 @@ import com.puppycrawl.tools.checkstyle.checks.FileContentsHolder; import com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck; import com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import nl.jqno.equalsverifier.EqualsVerifier; @@ -80,7 +80,7 @@ public class SuppressionCommentFilterTest @Test public void testNone() throws Exception { final DefaultConfiguration filterConfig = null; - final String[] suppressed = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] suppressed = CommonUtils.EMPTY_STRING_ARRAY; verifySuppressed(filterConfig, suppressed); } @@ -265,9 +265,9 @@ public class SuppressionCommentFilterTest final DefaultConfiguration filterConfig = createFilterConfig(SuppressionCommentFilter.class); filterConfig.addAttribute("checkFormat", "e[l"); - final String[] suppressed = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] suppressed = CommonUtils.EMPTY_STRING_ARRAY; verifySuppressed(filterConfig, suppressed); } catch (CheckstyleException ex) { @@ -282,9 +282,9 @@ public class SuppressionCommentFilterTest final DefaultConfiguration filterConfig = createFilterConfig(SuppressionCommentFilter.class); filterConfig.addAttribute("messageFormat", "e[l"); - final String[] suppressed = ArrayUtils.EMPTY_STRING_ARRAY; try { + final String[] suppressed = CommonUtils.EMPTY_STRING_ARRAY; verifySuppressed(filterConfig, suppressed); } catch (CheckstyleException ex) { 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 0edfff888..37f4a5537 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests that embedded nulls in string literals does not halt parsing. @@ -45,7 +45,7 @@ public class EmbeddedNullCharTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 c9c03005c..27b698cdd 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/GeneratedJava14LexerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/GeneratedJava14LexerTest.java @@ -22,14 +22,13 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.SystemUtils; import org.junit.Assume; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests GeneratedJava14Lexer. @@ -37,6 +36,14 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; */ public class GeneratedJava14LexerTest extends BaseCheckTestSupport { + + /** + *

Is {@code true} if this is Windows.

+ * + *

Adapted from org.apache.commons.lang3.SystemUtils.

+ */ + private static final boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows"); + @Override protected String getPath(String filename) throws IOException { return super.getPath("grammars" + File.separator + filename); @@ -50,7 +57,7 @@ public class GeneratedJava14LexerTest @Test public void testUnexpectedChar() throws Exception { // Encoding problems can occur in Windows - Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS); + Assume.assumeFalse(IS_WINDOWS); final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); @@ -66,7 +73,7 @@ public class GeneratedJava14LexerTest public void testSemicolonBetweenImports() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputSemicolonBetweenImports.java"), 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 8f2a7cf0c..3a72ee8a4 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests hex floats and doubles can be parsed. @@ -45,7 +45,7 @@ public class HexFloatsTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 0eea23228..a7e1aa3a2 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7DiamondTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7DiamondTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests Java 7 diamond can be parsed. @@ -45,7 +45,7 @@ public class Java7DiamondTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 4e45add37..e132c2567 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7MultiCatchTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7MultiCatchTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests Java 7 multi-catch can be parsed. @@ -45,7 +45,7 @@ public class Java7MultiCatchTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 0772af064..6e25fe347 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7NumericalLiteralsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7NumericalLiteralsTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests Java 7 numerical literals can be parsed. @@ -45,7 +45,7 @@ public class Java7NumericalLiteralsTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 a915d1a95..4db23678b 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7StringSwitchTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7StringSwitchTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests Java 7 String in switch can be parsed. @@ -45,7 +45,7 @@ public class Java7StringSwitchTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("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 5f78ec8ce..6804ed5d0 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7TryWithResourcesTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java7TryWithResourcesTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests Java 7 try-with-resources can be parsed. @@ -45,7 +45,7 @@ public class Java7TryWithResourcesTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputJava7TryWithResources.java"), expected); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java9TryWithResourcesTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java9TryWithResourcesTest.java index 178cbd7a3..b325fc1a3 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java9TryWithResourcesTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/Java9TryWithResourcesTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests Java 9 try-with-resources can be parsed. @@ -45,7 +45,7 @@ public class Java9TryWithResourcesTest extends BaseCheckTestSupport { public void testCanParse() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputJava9TryWithResources.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 6cd41ba5c..b907b1bf5 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/LineCommentAtTheEndOfFileTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/LineCommentAtTheEndOfFileTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Checks that file can be parsed, when it ends on line-comment but without @@ -47,7 +47,7 @@ public class LineCommentAtTheEndOfFileTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputLineCommentAtTheEndOfFile.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 15fbf10b1..c96652d6b 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/MultiDimensionalArraysInGenericsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/MultiDimensionalArraysInGenericsTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MultiDimensionalArraysInGenericsTest extends BaseCheckTestSupport { @@ -41,7 +41,7 @@ public class MultiDimensionalArraysInGenericsTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputMultiDimensionalArraysInGenerics.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 0fe66ce0d..a950c8eb3 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/UnicodeEscapeTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/UnicodeEscapeTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests that extended unicode escapes can be parsed. @@ -45,7 +45,7 @@ public class UnicodeEscapeTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputUnicodeEscape.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 086bfa58c..45953bb50 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; /** * Tests varargs can be parsed. @@ -45,7 +45,7 @@ public class VarargTest throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputVararg.java"), expected); } } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/AllBlockCommentsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/AllBlockCommentsTest.java index 812d29ea3..f535807e3 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/AllBlockCommentsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/AllBlockCommentsTest.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.util.Arrays; import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -34,6 +33,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AllBlockCommentsTest extends BaseCheckTestSupport { private static final Set ALL_COMMENTS = Sets.newLinkedHashSet(); @@ -49,7 +49,7 @@ public class AllBlockCommentsTest extends BaseCheckTestSupport { @Test public void testAllBlockComments() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(BlockCommentListenerCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputFullOfBlockComments.java"), expected); Assert.assertTrue(ALL_COMMENTS.isEmpty()); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/AllSinglelineCommentsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/AllSinglelineCommentsTest.java index 96fe2e78e..ee9a65647 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/AllSinglelineCommentsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/AllSinglelineCommentsTest.java @@ -23,7 +23,6 @@ import java.io.File; import java.io.IOException; import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -33,6 +32,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AllSinglelineCommentsTest extends BaseCheckTestSupport { private static final Set ALL_COMMENTS = Sets.newLinkedHashSet(); @@ -49,7 +49,7 @@ public class AllSinglelineCommentsTest extends BaseCheckTestSupport { public void testAllBlockComments() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(SinglelineCommentListenerCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputFullOfSinglelineComments.java"), expected); Assert.assertTrue(ALL_COMMENTS.isEmpty()); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/CompareTreesWithComments.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/CompareTreesWithComments.java index 58a8bfb7e..19886cb99 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/CompareTreesWithComments.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/comments/CompareTreesWithComments.java @@ -19,11 +19,11 @@ package com.puppycrawl.tools.checkstyle.grammars.comments; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; class CompareTreesWithComments extends AbstractCheck { private static DetailAST expectedTree; @@ -35,17 +35,17 @@ class CompareTreesWithComments extends AbstractCheck { @Override public int[] getDefaultTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getAcceptableTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override public int[] getRequiredTokens() { - return ArrayUtils.EMPTY_INT_ARRAY; + return CommonUtils.EMPTY_INT_ARRAY; } @Override 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 9b3c4c02d..215ef886c 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 @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AnnotationTest extends BaseCheckTestSupport { @Override @@ -47,7 +47,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputAnnotations1.java"), expected); } @@ -57,7 +57,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations2.java"), expected); } @@ -67,7 +67,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations3.java"), expected); } @@ -77,7 +77,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations4.java"), expected); } @@ -87,7 +87,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations5.java"), expected); } @@ -97,7 +97,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations6.java"), expected); } @@ -107,7 +107,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations7.java"), expected); } @@ -117,7 +117,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations8.java"), expected); } @@ -127,7 +127,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations9.java"), expected); } @@ -137,7 +137,7 @@ public class AnnotationTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotations10.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/AnnotationsOnArrayTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/AnnotationsOnArrayTest.java index 55fa41fd9..ca31b4991 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/AnnotationsOnArrayTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/AnnotationsOnArrayTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AnnotationsOnArrayTest extends BaseCheckTestSupport { @Override @@ -41,7 +41,7 @@ public class AnnotationsOnArrayTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputAnnotationsOnArray.java"), expected); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/DefaultMethodsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/DefaultMethodsTest.java index 59ed82569..027bbfd86 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/DefaultMethodsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/DefaultMethodsTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class DefaultMethodsTest extends BaseCheckTestSupport { @Override @@ -47,7 +47,7 @@ public class DefaultMethodsTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputDefaultMethods.java"), expected); } @@ -57,7 +57,7 @@ public class DefaultMethodsTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputDefaultMethods2.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 e17616454..32f50b287 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 @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class LambdaTest extends BaseCheckTestSupport { @Override @@ -41,7 +41,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda1.java"), expected); } @@ -51,7 +51,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda2.java"), expected); } @@ -61,7 +61,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda3.java"), expected); } @@ -71,7 +71,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda4.java"), expected); } @@ -81,7 +81,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda5.java"), expected); } @@ -91,7 +91,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda6.java"), expected); } @@ -101,7 +101,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda7.java"), expected); } @@ -111,7 +111,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda8.java"), expected); } @@ -121,7 +121,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda9.java"), expected); } @@ -131,7 +131,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda10.java"), expected); } @@ -141,7 +141,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda11.java"), expected); } @@ -151,7 +151,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda12.java"), expected); } @@ -161,7 +161,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda13.java"), expected); } @@ -171,7 +171,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda14.java"), expected); } @@ -181,7 +181,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda15.java"), expected); } @@ -191,7 +191,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda16.java"), expected); } @@ -201,7 +201,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda17.java"), expected); } @@ -211,7 +211,7 @@ public class LambdaTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputLambda18.java"), 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 75ed79859..63c079f9a 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 @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class MethodReferencesTest extends BaseCheckTestSupport { @Override @@ -41,7 +41,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputMethodReferences.java"), expected); } @@ -51,7 +51,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputMethodReferences2.java"), expected); } @@ -61,7 +61,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputMethodReferences3.java"), expected); } @@ -70,7 +70,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { public void testArrayAfterGeneric() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputMethodReferences4.java"), expected); } @@ -79,7 +79,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { public void testFromHiernate() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputMethodReferences5.java"), expected); } @@ -88,7 +88,7 @@ public class MethodReferencesTest extends BaseCheckTestSupport { public void testFromSpring() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputMethodReferences6.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/TypeUseAnnotationsOnQualifiedTypesTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/TypeUseAnnotationsOnQualifiedTypesTest.java index 5173cf0be..0170aead5 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/TypeUseAnnotationsOnQualifiedTypesTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/java8/TypeUseAnnotationsOnQualifiedTypesTest.java @@ -22,12 +22,12 @@ package com.puppycrawl.tools.checkstyle.grammars.java8; import java.io.File; import java.io.IOException; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Test; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class TypeUseAnnotationsOnQualifiedTypesTest extends BaseCheckTestSupport { @Override @@ -41,7 +41,7 @@ public class TypeUseAnnotationsOnQualifiedTypesTest extends BaseCheckTestSupport throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(MemberNameCheck.class); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getNonCompilablePath("InputTypeUseAnnotationsOnQualifiedTypes.java"), expected); diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java index d26c96a25..65b635234 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java @@ -26,7 +26,6 @@ import java.util.HashSet; import java.util.Locale; import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -36,12 +35,13 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.imports.ImportControlCheck; +import com.puppycrawl.tools.checkstyle.utils.CommonUtils; public class AllChecksTest extends BaseCheckTestSupport { @Test public void testAllChecksWithDefaultConfiguration() throws Exception { final String inputFilePath = getPath("InputDefaultConfig.java"); - final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; + final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; for (Class check : CheckUtil.getCheckstyleChecks()) { final DefaultConfiguration checkConfig = createCheckConfig(check);