diff options
author | rnveach <rveach02@gmail.com> | 2015-10-16 20:52:34 -0400 |
---|---|---|
committer | rnveach <rveach02@gmail.com> | 2015-10-16 21:52:06 -0400 |
commit | 96d3aaea19657ac233d9a57b46a52bc0b35eda95 (patch) | |
tree | 12a717b04f94041d52967ce2af1186d24e98550f /src/test/java | |
parent | e76a439c2b0250808ce2723c43cd872a1761e294 (diff) | |
download | checkstyle-96d3aaea19657ac233d9a57b46a52bc0b35eda95.tar.gz |
Issue #2161: unify test input locations for coding package
Diffstat (limited to 'src/test/java')
6 files changed, 51 insertions, 16 deletions
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java index 8123101ff..ed34c92b8 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java @@ -21,6 +21,9 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import static com.puppycrawl.tools.checkstyle.checks.coding.AvoidInlineConditionalsCheck.MSG_KEY; +import java.io.File; +import java.io.IOException; + import org.junit.Assert; import org.junit.Test; @@ -29,15 +32,21 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class AvoidInlineConditionalsCheckTest extends BaseCheckTestSupport { + @Override + protected String getPath(String filename) throws IOException { + return super.getPath("checks" + File.separator + + "coding" + File.separator + filename); + } + @Test public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(AvoidInlineConditionalsCheck.class); final String[] expected = { - "97:29: " + getCheckMessage(MSG_KEY), - "98:20: " + getCheckMessage(MSG_KEY), - "150:34: " + getCheckMessage(MSG_KEY), + "32:29: " + getCheckMessage(MSG_KEY), + "33:20: " + getCheckMessage(MSG_KEY), + "46:34: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputWhitespace.java"), expected); } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java index 5f3630c5c..75232abaa 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java @@ -24,6 +24,9 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderChec import static com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.MSG_INSTANCE; import static com.puppycrawl.tools.checkstyle.checks.coding.DeclarationOrderCheck.MSG_STATIC; +import java.io.File; +import java.io.IOException; + import org.junit.Assert; import org.junit.Test; @@ -34,6 +37,12 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; public class DeclarationOrderCheckTest extends BaseCheckTestSupport { + @Override + protected String getPath(String filename) throws IOException { + return super.getPath("checks" + File.separator + + "coding" + File.separator + filename); + } + @Test public void testDefault() throws Exception { final DefaultConfiguration checkConfig = @@ -68,7 +77,7 @@ public class DeclarationOrderCheckTest "178:5: " + getCheckMessage(MSG_INSTANCE), "182:9: " + getCheckMessage(MSG_ACCESS), }; - verify(checkConfig, getPath("coding/InputDeclarationOrder.java"), expected); + verify(checkConfig, getPath("InputDeclarationOrder.java"), expected); } @Test @@ -87,7 +96,7 @@ public class DeclarationOrderCheckTest "152:5: " + getCheckMessage(MSG_CONSTRUCTOR), "178:5: " + getCheckMessage(MSG_INSTANCE), }; - verify(checkConfig, getPath("coding/InputDeclarationOrder.java"), expected); + verify(checkConfig, getPath("InputDeclarationOrder.java"), expected); } @Test @@ -124,7 +133,7 @@ public class DeclarationOrderCheckTest "178:5: " + getCheckMessage(MSG_INSTANCE), "182:9: " + getCheckMessage(MSG_ACCESS), }; - verify(checkConfig, getPath("coding/InputDeclarationOrder.java"), expected); + verify(checkConfig, getPath("InputDeclarationOrder.java"), expected); } @Test @@ -162,5 +171,4 @@ public class DeclarationOrderCheckTest DeclarationOrderCheck check = new DeclarationOrderCheck(); check.visitToken(array); } - } diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckTest.java index 84c0104e3..2c55ba1ef 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckTest.java @@ -21,6 +21,9 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import static com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck.MSG_KEY; +import java.io.File; +import java.io.IOException; + import org.junit.Assert; import org.junit.Test; @@ -29,6 +32,12 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class EmptyStatementCheckTest extends BaseCheckTestSupport { + @Override + protected String getPath(String filename) throws IOException { + return super.getPath("checks" + File.separator + + "coding" + File.separator + filename); + } + @Test public void testEmptyStatements() throws Exception { 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 37de5fd04..b412a915e 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java @@ -21,6 +21,9 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import static com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck.MSG_KEY; +import java.io.File; +import java.io.IOException; + import org.apache.commons.lang3.ArrayUtils; import org.junit.Assert; import org.junit.Test; @@ -30,14 +33,20 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class EqualsHashCodeCheckTest extends BaseCheckTestSupport { + @Override + protected String getPath(String filename) throws IOException { + return super.getPath("checks" + File.separator + + "coding" + File.separator + filename); + } + @Test public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(EqualsHashCodeCheck.class); final String[] expected = { - "126:9: " + getCheckMessage(MSG_KEY), - "163:13: " + getCheckMessage(MSG_KEY), - "191:9: " + getCheckMessage(MSG_KEY), + "57:9: " + getCheckMessage(MSG_KEY), + "94:13: " + getCheckMessage(MSG_KEY), + "122:9: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -47,7 +56,7 @@ public class EqualsHashCodeCheckTest final DefaultConfiguration checkConfig = createCheckConfig(EqualsHashCodeCheck.class); final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY; - verify(checkConfig, getPath("coding/InputEqualsHashCodeCheck.java"), expected); + verify(checkConfig, getPath("InputEqualsHashCodeCheck.java"), expected); } @Test 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 33e782d1e..1a065ab6f 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 @@ -44,18 +44,18 @@ public class IllegalInstantiationCheckTest checkConfig.addAttribute( "classes", "java.lang.Boolean," - + "com.puppycrawl.tools.checkstyle.InputModifier," + + "com.puppycrawl.tools.checkstyle.checks.coding.InputModifier," + "java.io.File," + "java.awt.Color"); final String[] expected = { "19:21: " + getCheckMessage(MSG_KEY, "java.lang.Boolean"), "24:21: " + getCheckMessage(MSG_KEY, "java.lang.Boolean"), "31:16: " + getCheckMessage(MSG_KEY, "java.lang.Boolean"), - "38:21: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.InputModifier"), + "38:21: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.coding.InputModifier"), "41:18: " + getCheckMessage(MSG_KEY, "java.io.File"), "44:21: " + getCheckMessage(MSG_KEY, "java.awt.Color"), }; - verify(checkConfig, getPath("InputSemantic.java"), expected); + verify(checkConfig, getPath("checks/coding/InputSemantic.java"), expected); } @Test 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 a5f4ddb23..7a29a02b1 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 @@ -124,9 +124,9 @@ public class OneTopLevelClassCheckTest extends BaseCheckTestSupport { final DefaultConfiguration checkConfig = createCheckConfig(OneTopLevelClassCheck.class); final String[] expected = { - "83: " + getCheckMessage(MSG_KEY, "InputDeclarationOrderEnum"), + "10: " + getCheckMessage(MSG_KEY, "InputDeclarationOrderEnum"), }; - verify(checkConfig, getPath("coding" + File.separator + "InputDeclarationOrder.java"), expected); + verify(checkConfig, getPath("checks" + File.separator + "design" + File.separator + "InputDeclarationOrder.java"), expected); } @Test |