From 47f5a1d5ea40257878b4c61aa7db179e41e5340c Mon Sep 17 00:00:00 2001 From: Subbu Dantu Date: Tue, 1 Aug 2017 21:03:15 +0530 Subject: [PATCH] Issue #4592: Added AbstractPathTestSupport, AbstractModuleTestSupport, AbstractIndentationTestSupport and all tests in ITs extend them --- config/checkstyle_checks.xml | 4 +- config/intellij-idea-inspections.xml | 2 +- ...va => AbstractIndentationTestSupport.java} | 2 +- ...rt.java => AbstractModuleTestSupport.java} | 25 +++-------- .../test/base/AbstractPathTestSupport.java | 45 +++++++++++++++++++ .../rule21filename/OuterTypeFilenameTest.java | 12 ++--- .../rule231filetab/FileTabCharacterTest.java | 12 ++--- .../IllegalTokenTextTest.java | 12 ++--- .../AvoidEscapedUnicodeCharactersTest.java | 12 ++--- .../rule32packagestate/LineLengthTest.java | 12 ++--- .../AvoidStarImportTest.java | 12 ++--- .../rule332nolinewrap/NoLineWrapTest.java | 12 ++--- .../CustomImportOrderTest.java | 12 ++--- .../OneTopLevelClassTest.java | 12 ++--- .../OverloadMethodsDeclarationOrderTest.java | 12 ++--- .../EmptyLineSeparatorTest.java | 12 ++--- .../rule411bracesareused/NeedBracesTest.java | 12 ++--- .../rule412nonemptyblocks/LeftCurlyTest.java | 12 ++--- .../rule412nonemptyblocks/RightCurlyTest.java | 12 ++--- .../rule413emptyblocks/EmptyBlockTest.java | 12 ++--- .../EmptyCatchBlockTest.java | 12 ++--- .../OneStatementPerLineTest.java | 10 ++--- .../rule44columnlimit/LineLengthTest.java | 12 ++--- .../MethodParamPadTest.java | 12 ++--- .../rule451wheretobreak/OperatorWrapTest.java | 12 ++--- .../SeparatorWrapTest.java | 12 ++--- .../EmptyLineSeparatorTest.java | 12 ++--- .../GenericWhitespaceTest.java | 12 ++--- .../MethodParamPadTest.java | 12 ++--- .../ParenPadTest.java | 12 ++--- .../WhitespaceAroundTest.java | 12 ++--- .../MultipleVariableDeclarationsTest.java | 12 ++--- .../VariableDeclarationUsageDistanceTest.java | 12 ++--- .../ArrayTypeStyleTest.java | 12 ++--- .../rule4841indentation/IndentationTest.java | 12 ++--- .../rule4842fallthrough/FallThroughTest.java | 12 ++--- .../MissingSwitchDefaultTest.java | 12 ++--- .../AnnotationLocationTest.java | 12 ++--- .../CommentsIndentationTest.java | 12 ++--- .../rule487modifiers/ModifierOrderTest.java | 12 ++--- .../rule488numericliterals/UpperEllTest.java | 12 ++--- .../CatchParameterNameTest.java | 12 ++--- .../rule521packagenames/PackageNameTest.java | 12 +++-- .../rule522typenames/TypeNameTest.java | 12 ++--- .../rule523methodnames/MethodNameTest.java | 12 ++--- .../MemberNameTest.java | 12 ++--- .../ParameterNameTest.java | 11 ++--- .../LocalVariableNameTest.java | 12 ++--- .../ClassTypeParameterNameTest.java | 12 ++--- .../InterfaceTypeParameterNameTest.java | 12 ++--- .../MethodTypeParameterNameTest.java | 12 ++--- .../AbbreviationAsWordInNameTest.java | 12 ++--- .../EmptyBlockTest.java | 12 ++--- .../rule64finalizers/NoFinalizerTest.java | 12 ++--- .../SingleLineJavadocTest.java | 12 ++--- .../JavadocParagraphTest.java | 12 ++--- .../rule713atclauses/AtclauseOrderTest.java | 12 ++--- ...JavadocTagContinuationIndentationTest.java | 12 ++--- .../NonEmptyAtclauseDescriptionTest.java | 12 ++--- .../SummaryJavadocTest.java | 12 ++--- .../JavadocMethodTest.java | 12 ++--- 61 files changed, 283 insertions(+), 464 deletions(-) rename src/it/java/com/google/checkstyle/test/base/{BaseIndentationCheckSupport.java => AbstractIndentationTestSupport.java} (99%) rename src/it/java/com/google/checkstyle/test/base/{BaseCheckTestSupport.java => AbstractModuleTestSupport.java} (93%) create mode 100644 src/it/java/com/google/checkstyle/test/base/AbstractPathTestSupport.java diff --git a/config/checkstyle_checks.xml b/config/checkstyle_checks.xml index 2b88ede5e6a..49404c5561f 100644 --- a/config/checkstyle_checks.xml +++ b/config/checkstyle_checks.xml @@ -101,9 +101,9 @@ - + - + diff --git a/config/intellij-idea-inspections.xml b/config/intellij-idea-inspections.xml index 87850e038d5..95b73c03e83 100644 --- a/config/intellij-idea-inspections.xml +++ b/config/intellij-idea-inspections.xml @@ -2206,7 +2206,7 @@ - diff --git a/src/it/java/com/google/checkstyle/test/base/BaseIndentationCheckSupport.java b/src/it/java/com/google/checkstyle/test/base/AbstractIndentationTestSupport.java similarity index 99% rename from src/it/java/com/google/checkstyle/test/base/BaseIndentationCheckSupport.java rename to src/it/java/com/google/checkstyle/test/base/AbstractIndentationTestSupport.java index a35b073da1e..7ff0ffeef97 100644 --- a/src/it/java/com/google/checkstyle/test/base/BaseIndentationCheckSupport.java +++ b/src/it/java/com/google/checkstyle/test/base/AbstractIndentationTestSupport.java @@ -33,7 +33,7 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtils; -public class BaseIndentationCheckSupport extends BaseCheckTestSupport { +public abstract class AbstractIndentationTestSupport extends AbstractModuleTestSupport { private static final int TAB_WIDTH = 4; private static final Pattern NONEMPTY_LINE_REGEX = diff --git a/src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java b/src/it/java/com/google/checkstyle/test/base/AbstractModuleTestSupport.java similarity index 93% rename from src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java rename to src/it/java/com/google/checkstyle/test/base/AbstractModuleTestSupport.java index e52654dcc62..4fa3825e15d 100644 --- a/src/it/java/com/google/checkstyle/test/base/BaseCheckTestSupport.java +++ b/src/it/java/com/google/checkstyle/test/base/AbstractModuleTestSupport.java @@ -51,7 +51,7 @@ import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.utils.CommonUtils; -public class BaseCheckTestSupport { +public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport { private static final Pattern WARN_PATTERN = CommonUtils .createPattern(".*[ ]*//[ ]*warn[ ]*|/[*]\\s?warn\\s?[*]/"); @@ -132,26 +132,13 @@ protected DefaultConfiguration createCheckerConfig(Configuration config) { return dc; } - /** - * Returns canonical path for the file with the given file name. - * The path is formed based on the specific root location. - * This implementation uses 'src/it/resources/com/google/checkstyle/test/' as a root location. - * @param fileName file name. - * @return canonical path for the the file with the given file name. - * @throws IOException if I/O exception occurs while forming the path. - */ - protected String getPath(String fileName) throws IOException { - return new File("src/it/resources/com/google/checkstyle/test/" + fileName) - .getCanonicalPath(); - } - /** * Performs verification of the file with given file name. Uses specified configuration. * Expected messages are represented by the array of strings, warning line numbers are * represented by the array of integers. * This implementation uses overloaded - * {@link BaseCheckTestSupport#verify(Checker, File[], String, String[], Integer...)} method - * inside. + * {@link AbstractModuleTestSupport#verify(Checker, File[], String, String[], Integer...)} + * method inside. * @param config configuration. * @param fileName file name to verify. * @param expected an array of expected messages. @@ -260,7 +247,7 @@ protected String getCheckMessage(Map messages, String messageKey /** * Returns {@link Configuration} instance for the given check name. - * This implementation uses {@link BaseCheckTestSupport#getConfiguration()} method inside. + * This implementation uses {@link AbstractModuleTestSupport#getConfiguration()} method inside. * @param checkName check name. * @return {@link Configuration} instance for the given check name. * @throws CheckstyleException if exception occurs during configuration loading. @@ -279,7 +266,7 @@ protected static Configuration getCheckConfig(String checkName) throws Checkstyl /** * Returns {@link Configuration} instance for the given check name. - * This implementation uses {@link BaseCheckTestSupport#getConfiguration()} method inside. + * This implementation uses {@link AbstractModuleTestSupport#getConfiguration()} method inside. * @param checkName check name. * @return {@link Configuration} instance for the given check name. * @throws CheckstyleException if exception occurs during configuration loading. @@ -307,7 +294,7 @@ protected static Configuration getCheckConfig(String checkName, String checkId) /** * Returns a list of all {@link Configuration} instances for the given check name. - * This implementation uses {@link BaseCheckTestSupport#getConfiguration()} method inside. + * This implementation uses {@link AbstractModuleTestSupport#getConfiguration()} method inside. * @param checkName check name. * @return {@link Configuration} instance for the given check name. * @throws CheckstyleException if exception occurs during configuration loading. diff --git a/src/it/java/com/google/checkstyle/test/base/AbstractPathTestSupport.java b/src/it/java/com/google/checkstyle/test/base/AbstractPathTestSupport.java new file mode 100644 index 00000000000..dfd14a8091d --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/base/AbstractPathTestSupport.java @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2017 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.base; + +import java.io.File; +import java.io.IOException; + +public abstract class AbstractPathTestSupport { + /** + * Returns the exact location for the package where the file is present. + * @return path for the package name for the file. + */ + protected abstract String getPackageLocation(); + + /** + * Returns canonical path for the file with the given file name. + * The path is formed base on the root location. + * This implementation uses 'src/test/resources/' + * as a root location. + * @param filename file name. + * @return canonical path for the file name. + * @throws IOException if I/O exception occurs while forming the path. + */ + protected final String getPath(String filename) throws IOException { + return new File("src/it/resources/" + getPackageLocation() + "/" + filename) + .getCanonicalPath(); + } +} 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 cd81962dc15..0c1726dc8f0 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 @@ -21,22 +21,18 @@ import static com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck.MSG_KEY; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class OuterTypeFilenameTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter2filebasic" + File.separator + "rule21filename" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter2filebasic/rule21filename"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/FileTabCharacterTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/FileTabCharacterTest.java index 88f46f58533..1a23f05d51e 100644 --- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/FileTabCharacterTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/FileTabCharacterTest.java @@ -19,22 +19,18 @@ package com.google.checkstyle.test.chapter2filebasic.rule231filetab; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck; -public class FileTabCharacterTest extends BaseCheckTestSupport { +public class FileTabCharacterTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter2filebasic" + File.separator + "rule231filetab" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter2filebasic/rule231filetab"; } @Override diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/IllegalTokenTextTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/IllegalTokenTextTest.java index 00347252b3f..933b4217954 100644 --- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/IllegalTokenTextTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/IllegalTokenTextTest.java @@ -19,20 +19,16 @@ package com.google.checkstyle.test.chapter2filebasic.rule232specialescape; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class IllegalTokenTextTest extends BaseCheckTestSupport { +public class IllegalTokenTextTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter2filebasic" + File.separator + "rule232specialescape" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter2filebasic/rule232specialescape"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/AvoidEscapedUnicodeCharactersTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/AvoidEscapedUnicodeCharactersTest.java index 96acfae0a20..452ae478b02 100644 --- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/AvoidEscapedUnicodeCharactersTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/AvoidEscapedUnicodeCharactersTest.java @@ -21,21 +21,17 @@ import static com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck.MSG_KEY; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck; -public class AvoidEscapedUnicodeCharactersTest extends BaseCheckTestSupport { +public class AvoidEscapedUnicodeCharactersTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter2filebasic" + File.separator + "rule233nonascii" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter2filebasic/rule233nonascii"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestate/LineLengthTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestate/LineLengthTest.java index ba66401cbe4..7b18b013176 100644 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestate/LineLengthTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestate/LineLengthTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter3filestructure.rule32packagestate; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck; -public class LineLengthTest extends BaseCheckTestSupport { +public class LineLengthTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter3filestructure" + File.separator + "rule32packagestate" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule32packagestate"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/AvoidStarImportTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/AvoidStarImportTest.java index 611c5a69374..4b53e15c537 100644 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/AvoidStarImportTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/AvoidStarImportTest.java @@ -19,20 +19,16 @@ package com.google.checkstyle.test.chapter3filestructure.rule331nowildcard; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class AvoidStarImportTest extends BaseCheckTestSupport { +public class AvoidStarImportTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter3filestructure" + File.separator + "rule331nowildcard" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule331nowildcard"; } @Test 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 c46af1d8a2d..75983f038c0 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 @@ -19,23 +19,19 @@ package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class NoLineWrapTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter3filestructure" + File.separator + "rule332nolinewrap" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap"; } @Test 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 299fd871646..93b4203340b 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 @@ -19,17 +19,14 @@ package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class CustomImportOrderTest extends AbstractModuleTestSupport { /** Shortcuts to make code more compact. */ private static final String MSG_LINE_SEPARATOR = CustomImportOrderCheck.MSG_LINE_SEPARATOR; @@ -42,9 +39,8 @@ public class CustomImportOrderTest extends BaseCheckTestSupport { private final Class clazz = CustomImportOrderCheck.class; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter3filestructure" + File.separator + "rule333orderingandspacing" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing"; } @Test 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 90d68d9c9bb..1f4c617fb32 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 @@ -19,22 +19,18 @@ package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class OneTopLevelClassTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter3filestructure" + File.separator + "rule341onetoplevel" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java index 09240c6a17f..a2727c92b6a 100644 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter3filestructure.rule3421overloadsplit; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.coding.OverloadMethodsDeclarationOrderCheck; -public class OverloadMethodsDeclarationOrderTest extends BaseCheckTestSupport { +public class OverloadMethodsDeclarationOrderTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter3filestructure" + File.separator + "rule3421overloadsplit" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java index 47e407ddd38..652a4b66225 100644 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter3filestructure.rule3sourcefile; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck; -public class EmptyLineSeparatorTest extends BaseCheckTestSupport { +public class EmptyLineSeparatorTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter3filestructure" + File.separator + "rule3sourcefile" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule3sourcefile"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/NeedBracesTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/NeedBracesTest.java index 658250704dc..44649ac5616 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/NeedBracesTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/NeedBracesTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule411bracesareused; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck; -public class NeedBracesTest extends BaseCheckTestSupport { +public class NeedBracesTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule411bracesareused" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule411bracesareused"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyTest.java index d37149f6804..124907001b4 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyTest.java @@ -21,21 +21,17 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck.MSG_KEY_LINE_PREVIOUS; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck; -public class LeftCurlyTest extends BaseCheckTestSupport { +public class LeftCurlyTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule412nonemptyblocks" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks"; } @Test 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 cbd7819ed82..a1fa8877f09 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 @@ -24,22 +24,18 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_NEW; import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_SAME; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck; import com.puppycrawl.tools.checkstyle.utils.CommonUtils; -public class RightCurlyTest extends BaseCheckTestSupport { +public class RightCurlyTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule412nonemptyblocks" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlockTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlockTest.java index b5409db5ab4..58d1eec1840 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlockTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlockTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck; -public class EmptyBlockTest extends BaseCheckTestSupport { +public class EmptyBlockTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule413emptyblocks" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule413emptyblocks"; } @Test 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 89d4f72e26d..452c21cc89b 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 @@ -19,22 +19,18 @@ package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class EmptyCatchBlockTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule413emptyblocks" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule413emptyblocks"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java index e5344a6b04d..fc6491fc0c1 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java @@ -20,20 +20,18 @@ package com.google.checkstyle.test.chapter4formatting.rule43onestatement; import java.io.File; -import java.io.IOException; import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck; -public class OneStatementPerLineTest extends BaseCheckTestSupport { +public class OneStatementPerLineTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule43onestatement" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule43onestatement"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/LineLengthTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/LineLengthTest.java index af0b242d352..d22ae670389 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/LineLengthTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/LineLengthTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule44columnlimit; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck; -public class LineLengthTest extends BaseCheckTestSupport { +public class LineLengthTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule44columnlimit" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule44columnlimit"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/MethodParamPadTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/MethodParamPadTest.java index 558e018e5b3..59c989738c2 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/MethodParamPadTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/MethodParamPadTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck; -public class MethodParamPadTest extends BaseCheckTestSupport { +public class MethodParamPadTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule451wheretobreak" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule451wheretobreak"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/OperatorWrapTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/OperatorWrapTest.java index e0041e1d40b..2858bfa26b4 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/OperatorWrapTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/OperatorWrapTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck; -public class OperatorWrapTest extends BaseCheckTestSupport { +public class OperatorWrapTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule451wheretobreak" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule451wheretobreak"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/SeparatorWrapTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/SeparatorWrapTest.java index 86a8d9458b9..bb6f62d50f7 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/SeparatorWrapTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/SeparatorWrapTest.java @@ -21,21 +21,17 @@ import static com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck.MSG_LINE_NEW; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck; -public class SeparatorWrapTest extends BaseCheckTestSupport { +public class SeparatorWrapTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule451wheretobreak" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule451wheretobreak"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/EmptyLineSeparatorTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/EmptyLineSeparatorTest.java index 8097138b48f..888b7d9914b 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/EmptyLineSeparatorTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/EmptyLineSeparatorTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck; -public class EmptyLineSeparatorTest extends BaseCheckTestSupport { +public class EmptyLineSeparatorTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule461verticalwhitespace" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java index c750d9d2b7b..cb4e2a5b236 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java @@ -19,20 +19,16 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class GenericWhitespaceTest extends BaseCheckTestSupport { +public class GenericWhitespaceTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule462horizontalwhitespace" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/MethodParamPadTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/MethodParamPadTest.java index 35294af604a..28dea04c47e 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/MethodParamPadTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/MethodParamPadTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck; -public class MethodParamPadTest extends BaseCheckTestSupport { +public class MethodParamPadTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule462horizontalwhitespace" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/ParenPadTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/ParenPadTest.java index 6c8e1b11910..08574b36c2a 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/ParenPadTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/ParenPadTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck; -public class ParenPadTest extends BaseCheckTestSupport { +public class ParenPadTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule462horizontalwhitespace" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; } @Test 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 4c9944bf219..bd58198968f 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 @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.utils.CommonUtils; -public class WhitespaceAroundTest extends BaseCheckTestSupport { +public class WhitespaceAroundTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule462horizontalwhitespace" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/MultipleVariableDeclarationsTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/MultipleVariableDeclarationsTest.java index 9958cd9a04d..9a10611d9e2 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/MultipleVariableDeclarationsTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/MultipleVariableDeclarationsTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule4821onevariableperline; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck; -public class MultipleVariableDeclarationsTest extends BaseCheckTestSupport { +public class MultipleVariableDeclarationsTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule4821onevariableperline" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/VariableDeclarationUsageDistanceTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/VariableDeclarationUsageDistanceTest.java index 1d9221cdfc0..954d954144d 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/VariableDeclarationUsageDistanceTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/VariableDeclarationUsageDistanceTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule4822variabledistance; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck; -public class VariableDeclarationUsageDistanceTest extends BaseCheckTestSupport { +public class VariableDeclarationUsageDistanceTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule4822variabledistance" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4822variabledistance"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/ArrayTypeStyleTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/ArrayTypeStyleTest.java index e71861d05f7..2b5f021de82 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/ArrayTypeStyleTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/ArrayTypeStyleTest.java @@ -21,21 +21,17 @@ import static com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck.MSG_KEY; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck; -public class ArrayTypeStyleTest extends BaseCheckTestSupport { +public class ArrayTypeStyleTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule4832nocstylearray" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray"; } @Test 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 3976fca4321..a778e849d47 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 @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule4841indentation; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseIndentationCheckSupport; +import com.google.checkstyle.test.base.AbstractIndentationTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.utils.CommonUtils; -public class IndentationTest extends BaseIndentationCheckSupport { +public class IndentationTest extends AbstractIndentationTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule4841indentation" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4841indentation"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughTest.java index 466199a4c01..f5055988c49 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule4842fallthrough; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.coding.FallThroughCheck; -public class FallThroughTest extends BaseCheckTestSupport { +public class FallThroughTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule4842fallthrough" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4842fallthrough"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/MissingSwitchDefaultTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/MissingSwitchDefaultTest.java index 439d8198838..31babbad95f 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/MissingSwitchDefaultTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/MissingSwitchDefaultTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule4843defaultcasepresent; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.coding.MissingSwitchDefaultCheck; -public class MissingSwitchDefaultTest extends BaseCheckTestSupport { +public class MissingSwitchDefaultTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule4843defaultcasepresent" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java index c3ea5949920..b273553c7c8 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule485annotations; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck; -public class AnnotationLocationTest extends BaseCheckTestSupport { +public class AnnotationLocationTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule485annotations" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule485annotations"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/CommentsIndentationTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/CommentsIndentationTest.java index 8283ca324c1..374d3c92989 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/CommentsIndentationTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/CommentsIndentationTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck; -public class CommentsIndentationTest extends BaseCheckTestSupport { +public class CommentsIndentationTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule4861blockcommentstyle" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifierOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifierOrderTest.java index 9ecea409fb2..01086de296f 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifierOrderTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifierOrderTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter4formatting.rule487modifiers; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck; -public class ModifierOrderTest extends BaseCheckTestSupport { +public class ModifierOrderTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule487modifiers" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule487modifiers"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/UpperEllTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/UpperEllTest.java index a317e752f71..059b7f0af71 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/UpperEllTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/UpperEllTest.java @@ -19,20 +19,16 @@ package com.google.checkstyle.test.chapter4formatting.rule488numericliterals; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class UpperEllTest extends BaseCheckTestSupport { +public class UpperEllTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter4formatting" + File.separator + "rule488numericliterals" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule488numericliterals"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/CatchParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/CatchParameterNameTest.java index b38e4c60050..9ef8fede6f1 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/CatchParameterNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/CatchParameterNameTest.java @@ -19,24 +19,20 @@ package com.google.checkstyle.test.chapter5naming.rule51identifiernames; -import java.io.File; -import java.io.IOException; - import org.junit.BeforeClass; import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class CatchParameterNameTest extends BaseCheckTestSupport { +public class CatchParameterNameTest extends AbstractModuleTestSupport { private static Configuration checkConfig; private static String format; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule51identifiernames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule51identifiernames"; } @BeforeClass 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 91f690b165f..1b49082d16b 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 @@ -25,20 +25,24 @@ import org.junit.BeforeClass; import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class PackageNameTest extends AbstractModuleTestSupport { private static final String MSG_KEY = "name.invalidPattern"; private static Configuration checkConfig; private static String format; + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming"; + } + private String getPath(String packageName, String fileName) throws IOException { - return getPath("chapter5naming" + File.separator + "rule521" + packageName - + File.separator + fileName); + return super.getPath("rule521" + packageName + File.separator + fileName); } @BeforeClass diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule522typenames/TypeNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule522typenames/TypeNameTest.java index ae72f38039e..6b348f3379b 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule522typenames/TypeNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule522typenames/TypeNameTest.java @@ -19,20 +19,16 @@ package com.google.checkstyle.test.chapter5naming.rule522typenames; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class TypeNameTest extends BaseCheckTestSupport { +public class TypeNameTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule522typenames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule522typenames"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNameTest.java index 1a3d3f52ab5..48c707bfcb4 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNameTest.java @@ -19,20 +19,16 @@ package com.google.checkstyle.test.chapter5naming.rule523methodnames; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class MethodNameTest extends BaseCheckTestSupport { +public class MethodNameTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule523methodnames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule523methodnames"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/MemberNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/MemberNameTest.java index a85881d1320..6363b008e67 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/MemberNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/MemberNameTest.java @@ -19,26 +19,22 @@ package com.google.checkstyle.test.chapter5naming.rule525nonconstantfieldnames; -import java.io.File; -import java.io.IOException; - import org.junit.BeforeClass; import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class MemberNameTest extends BaseCheckTestSupport { +public class MemberNameTest extends AbstractModuleTestSupport { private static final String MSG_KEY = "name.invalidPattern"; private static Configuration checkConfig; private static String format; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule525nonconstantfieldnames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames"; } @BeforeClass diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNameTest.java index 2933c72dd71..3c7df68459f 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNameTest.java @@ -19,28 +19,25 @@ package com.google.checkstyle.test.chapter5naming.rule526parameternames; -import java.io.File; -import java.io.IOException; import java.util.List; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class ParameterNameTest extends BaseCheckTestSupport { +public class ParameterNameTest extends AbstractModuleTestSupport { private static final String MSG_KEY = "name.invalidPattern"; private static String format; private static Configuration config; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule526parameternames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule526parameternames"; } @BeforeClass diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNameTest.java index 1e6ee14bc13..b019caa4545 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNameTest.java @@ -19,26 +19,22 @@ package com.google.checkstyle.test.chapter5naming.rule527localvariablenames; -import java.io.File; -import java.io.IOException; - import org.junit.BeforeClass; import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class LocalVariableNameTest extends BaseCheckTestSupport { +public class LocalVariableNameTest extends AbstractModuleTestSupport { private static final String MSG_KEY = "name.invalidPattern"; private static Configuration checkConfig; private static String format; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule527localvariablenames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule527localvariablenames"; } @BeforeClass diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/ClassTypeParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/ClassTypeParameterNameTest.java index c04edfef1fd..4ab109129f9 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/ClassTypeParameterNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/ClassTypeParameterNameTest.java @@ -19,22 +19,18 @@ package com.google.checkstyle.test.chapter5naming.rule528typevariablenames; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class ClassTypeParameterNameTest extends BaseCheckTestSupport { +public class ClassTypeParameterNameTest extends AbstractModuleTestSupport { private static final String MSG_KEY = "name.invalidPattern"; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule528typevariablenames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule528typevariablenames"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InterfaceTypeParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InterfaceTypeParameterNameTest.java index fcce18734e9..1f52b7db5dc 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InterfaceTypeParameterNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InterfaceTypeParameterNameTest.java @@ -19,22 +19,18 @@ package com.google.checkstyle.test.chapter5naming.rule528typevariablenames; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class InterfaceTypeParameterNameTest extends BaseCheckTestSupport { +public class InterfaceTypeParameterNameTest extends AbstractModuleTestSupport { private static final String MSG_KEY = "name.invalidPattern"; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule528typevariablenames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule528typevariablenames"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/MethodTypeParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/MethodTypeParameterNameTest.java index be24cd16b7c..7394b67bb43 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/MethodTypeParameterNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/MethodTypeParameterNameTest.java @@ -19,25 +19,21 @@ package com.google.checkstyle.test.chapter5naming.rule528typevariablenames; -import java.io.File; -import java.io.IOException; - import org.junit.BeforeClass; import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; -public class MethodTypeParameterNameTest extends BaseCheckTestSupport { +public class MethodTypeParameterNameTest extends AbstractModuleTestSupport { private static final String MSG_KEY = "name.invalidPattern"; private static String format; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule528typevariablenames" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule528typevariablenames"; } @BeforeClass diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/AbbreviationAsWordInNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/AbbreviationAsWordInNameTest.java index ad4ecbc148e..2a134f6b795 100644 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/AbbreviationAsWordInNameTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/AbbreviationAsWordInNameTest.java @@ -19,24 +19,20 @@ package com.google.checkstyle.test.chapter5naming.rule53camelcase; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck; -public class AbbreviationAsWordInNameTest extends BaseCheckTestSupport { +public class AbbreviationAsWordInNameTest extends AbstractModuleTestSupport { private static final String MSG_KEY = "abbreviation.as.word"; private final Class clazz = AbbreviationAsWordInNameCheck.class; @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter5naming" + File.separator + "rule53camelcase" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule53camelcase"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/EmptyBlockTest.java b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/EmptyBlockTest.java index 9fa2885ec33..a3713e7255a 100644 --- a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/EmptyBlockTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/EmptyBlockTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter6programpractice.rule62donotignoreexceptions; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck; -public class EmptyBlockTest extends BaseCheckTestSupport { +public class EmptyBlockTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter6programpractice" + File.separator - + "rule62donotignoreexceptions" + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java index 381f2c5f7a1..0fc114c5c66 100644 --- a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter6programpractice.rule64finalizers; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.coding.NoFinalizerCheck; -public class NoFinalizerTest extends BaseCheckTestSupport { +public class NoFinalizerTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter6programpractice" + File.separator + "rule64finalizers" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter6programpractice/rule64finalizers"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/SingleLineJavadocTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/SingleLineJavadocTest.java index 623b2555f32..728e7c20230 100644 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/SingleLineJavadocTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/SingleLineJavadocTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter7javadoc.rule711generalform; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.javadoc.SingleLineJavadocCheck; -public class SingleLineJavadocTest extends BaseCheckTestSupport { +public class SingleLineJavadocTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter7javadoc" + File.separator + "rule711generalform" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule711generalform"; } @Test 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 6181e105e36..6a9f6e25d3b 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 @@ -19,22 +19,18 @@ package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class JavadocParagraphTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter7javadoc" + File.separator + "rule712paragraphs" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule712paragraphs"; } @Test 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 ca6d2ae8c95..ffa92fed7fe 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 @@ -19,22 +19,18 @@ package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class AtclauseOrderTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter7javadoc" + File.separator + "rule713atclauses" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule713atclauses"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/JavadocTagContinuationIndentationTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/JavadocTagContinuationIndentationTest.java index defbc6159c0..c1eb4ecf65a 100644 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/JavadocTagContinuationIndentationTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/JavadocTagContinuationIndentationTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagContinuationIndentationCheck; -public class JavadocTagContinuationIndentationTest extends BaseCheckTestSupport { +public class JavadocTagContinuationIndentationTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter7javadoc" + File.separator + "rule713atclauses" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule713atclauses"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java index 7b8cc4d7d0d..9ac36bd08bf 100644 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.javadoc.NonEmptyAtclauseDescriptionCheck; -public class NonEmptyAtclauseDescriptionTest extends BaseCheckTestSupport { +public class NonEmptyAtclauseDescriptionTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter7javadoc" + File.separator + "rule713atclauses" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule713atclauses"; } @Test 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 a688eb08509..315011b349e 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 @@ -19,22 +19,18 @@ package com.google.checkstyle.test.chapter7javadoc.rule72thesummaryfragment; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; 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 { +public class SummaryJavadocTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter7javadoc" + File.separator + "rule72thesummaryfragment" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment"; } @Test diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/JavadocMethodTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/JavadocMethodTest.java index 1134b543365..0a345fb394e 100644 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/JavadocMethodTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/JavadocMethodTest.java @@ -19,21 +19,17 @@ package com.google.checkstyle.test.chapter7javadoc.rule731selfexplanatory; -import java.io.File; -import java.io.IOException; - import org.junit.Test; -import com.google.checkstyle.test.base.BaseCheckTestSupport; +import com.google.checkstyle.test.base.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck; -public class JavadocMethodTest extends BaseCheckTestSupport { +public class JavadocMethodTest extends AbstractModuleTestSupport { @Override - protected String getPath(String fileName) throws IOException { - return super.getPath("chapter7javadoc" + File.separator + "rule731selfexplanatory" - + File.separator + fileName); + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory"; } @Test