diff --git a/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java b/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java index 293d2934b..96971f498 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java @@ -1,5 +1,6 @@ package com.puppycrawl.tools.checkstyle; +import com.puppycrawl.tools.checkstyle.checks.*; import com.puppycrawl.tools.checkstyle.checks.AvoidStarImportTest; import com.puppycrawl.tools.checkstyle.checks.ConstantNameCheckTest; import com.puppycrawl.tools.checkstyle.checks.EmptyBlockCheckTest; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/RedundantModifierTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/RedundantModifierTest.java similarity index 60% rename from src/tests/com/puppycrawl/tools/checkstyle/RedundantModifierTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/RedundantModifierTest.java index f3bdd680f..86f43e654 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/RedundantModifierTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/RedundantModifierTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.RedundantModifierCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class RedundantModifierTest extends BaseCheckTestCase @@ -10,12 +11,10 @@ public class RedundantModifierTest { final DefaultConfiguration checkConfig = createCheckConfig(RedundantModifierCheck.class); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputModifier.java"); final String[] expected = { "32:9: Redundant 'public' modifier.", "38:9: Redundant 'abstract' modifier.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputModifier.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/RightCurlyCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/RightCurlyCheckTest.java similarity index 67% rename from src/tests/com/puppycrawl/tools/checkstyle/RightCurlyCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/RightCurlyCheckTest.java index 2d2fd210a..b7888639b 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/RightCurlyCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/RightCurlyCheckTest.java @@ -1,7 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.RightCurlyCheck; -import com.puppycrawl.tools.checkstyle.checks.RightCurlyOption; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class RightCurlyCheckTest extends BaseCheckTestCase @@ -11,15 +11,13 @@ public class RightCurlyCheckTest { final DefaultConfiguration checkConfig = createCheckConfig(RightCurlyCheck.class); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputLeftCurlyOther.java"); final String[] expected = { "25:17: '}' should be on the same line.", "28:17: '}' should be on the same line.", "40:13: '}' should be on the same line.", "44:13: '}' should be on the same line.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputLeftCurlyOther.java"), expected); } public void testSame() @@ -28,15 +26,13 @@ public class RightCurlyCheckTest final DefaultConfiguration checkConfig = createCheckConfig(RightCurlyCheck.class); checkConfig.addAttribute("option", RightCurlyOption.SAME.toString()); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputLeftCurlyOther.java"); final String[] expected = { "25:17: '}' should be on the same line.", "28:17: '}' should be on the same line.", "40:13: '}' should be on the same line.", "44:13: '}' should be on the same line.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputLeftCurlyOther.java"), expected); } public void testAlone() @@ -45,10 +41,8 @@ public class RightCurlyCheckTest final DefaultConfiguration checkConfig = createCheckConfig(RightCurlyCheck.class); checkConfig.addAttribute("option", RightCurlyOption.ALONE.toString()); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputLeftCurlyOther.java"); final String[] expected = { }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputLeftCurlyOther.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/SimplifyBooleanExpressionCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/SimplifyBooleanExpressionCheckTest.java similarity index 71% rename from src/tests/com/puppycrawl/tools/checkstyle/SimplifyBooleanExpressionCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/SimplifyBooleanExpressionCheckTest.java index 44afbed3a..dcb833b5a 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/SimplifyBooleanExpressionCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/SimplifyBooleanExpressionCheckTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.SimplifyBooleanExpressionCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class SimplifyBooleanExpressionCheckTest extends BaseCheckTestCase @@ -10,8 +11,6 @@ public class SimplifyBooleanExpressionCheckTest { final DefaultConfiguration checkConfig = createCheckConfig(SimplifyBooleanExpressionCheck.class); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputSimplifyBoolean.java"); final String[] expected = { "20:18: Expression can be simplified.", "41:36: Expression can be simplified.", @@ -21,6 +20,6 @@ public class SimplifyBooleanExpressionCheckTest // TODO: Change Check.log to avoid duplicate messages "43:32: Expression can be simplified.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputSimplifyBoolean.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/SimplifyBooleanReturnCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/SimplifyBooleanReturnCheckTest.java similarity index 66% rename from src/tests/com/puppycrawl/tools/checkstyle/SimplifyBooleanReturnCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/SimplifyBooleanReturnCheckTest.java index 338dbeefa..331bd0868 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/SimplifyBooleanReturnCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/SimplifyBooleanReturnCheckTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.SimplifyBooleanReturnCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; /* * Created by IntelliJ IDEA. @@ -17,12 +18,10 @@ public class SimplifyBooleanReturnCheckTest { final DefaultConfiguration checkConfig = createCheckConfig(SimplifyBooleanReturnCheck.class); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputSimplifyBoolean.java"); final String[] expected = { "20:9: Remove conditional logic.", "33:9: Remove conditional logic.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputSimplifyBoolean.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/StaticVariableNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/StaticVariableNameCheckTest.java similarity index 63% rename from src/tests/com/puppycrawl/tools/checkstyle/StaticVariableNameCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/StaticVariableNameCheckTest.java index 3576b7862..b5a721a52 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/StaticVariableNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/StaticVariableNameCheckTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.StaticVariableNameCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class StaticVariableNameCheckTest extends BaseCheckTestCase @@ -11,12 +12,10 @@ public class StaticVariableNameCheckTest final DefaultConfiguration checkConfig = createCheckConfig(StaticVariableNameCheck.class); checkConfig.addAttribute("format", "^s[A-Z][a-zA-Z0-9]*$"); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputSimple.java"); final String[] expected = { "30:24: Name 'badStatic' must match pattern '^s[A-Z][a-zA-Z0-9]*$'.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputSimple.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/TabCharacterCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/TabCharacterCheckTest.java similarity index 73% rename from src/tests/com/puppycrawl/tools/checkstyle/TabCharacterCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/TabCharacterCheckTest.java index 4be73de92..a3a22f3e4 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/TabCharacterCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/TabCharacterCheckTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.TabCharacterCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class TabCharacterCheckTest extends BaseCheckTestCase @@ -9,8 +10,6 @@ public class TabCharacterCheckTest { final DefaultConfiguration checkConfig = createCheckConfig(TabCharacterCheck.class); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputSimple.java"); final String[] expected = { "19:25: Line contains a tab character.", "145:35: Line contains a tab character.", @@ -21,6 +20,6 @@ public class TabCharacterCheckTest "157:3: Line contains a tab character.", "158:3: Line contains a tab character." }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputSimple.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/TodoCommentCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheckTest.java old mode 100755 new mode 100644 similarity index 69% rename from src/tests/com/puppycrawl/tools/checkstyle/TodoCommentCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheckTest.java index 3a0deebf6..910fb9489 --- a/src/tests/com/puppycrawl/tools/checkstyle/TodoCommentCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheckTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class TodoCommentCheckTest extends BaseCheckTestCase @@ -11,14 +12,12 @@ public class TodoCommentCheckTest final DefaultConfiguration checkConfig = createCheckConfig(TodoCommentCheck.class); checkConfig.addAttribute("format", "FIXME:"); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputSimple.java"); final String[] expected = { "161: Comment matches to-do format 'FIXME:'.", "162: Comment matches to-do format 'FIXME:'.", "163: Comment matches to-do format 'FIXME:'.", "167: Comment matches to-do format 'FIXME:'.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputSimple.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/TypeLeftCurlyCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/TypeLeftCurlyCheckTest.java similarity index 68% rename from src/tests/com/puppycrawl/tools/checkstyle/TypeLeftCurlyCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/TypeLeftCurlyCheckTest.java index 85df48cf6..fc5a50888 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/TypeLeftCurlyCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/TypeLeftCurlyCheckTest.java @@ -1,7 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.TypeLeftCurlyCheck; -import com.puppycrawl.tools.checkstyle.checks.LeftCurlyOption; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class TypeLeftCurlyCheckTest extends BaseCheckTestCase @@ -11,8 +11,6 @@ public class TypeLeftCurlyCheckTest { final DefaultConfiguration checkConfig = createCheckConfig(TypeLeftCurlyCheck.class); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputScopeInnerInterfaces.java"); final String[] expected = { "8:1: '{' should be on the previous line.", "12:5: '{' should be on the previous line.", @@ -20,7 +18,7 @@ public class TypeLeftCurlyCheckTest "30:5: '{' should be on the previous line.", "39:5: '{' should be on the previous line.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected); } public void testNL() @@ -29,11 +27,9 @@ public class TypeLeftCurlyCheckTest final DefaultConfiguration checkConfig = createCheckConfig(TypeLeftCurlyCheck.class); checkConfig.addAttribute("option", LeftCurlyOption.NL.toString()); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputScopeInnerInterfaces.java"); final String[] expected = { }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected); } public void testNLOW() @@ -42,8 +38,6 @@ public class TypeLeftCurlyCheckTest final DefaultConfiguration checkConfig = createCheckConfig(TypeLeftCurlyCheck.class); checkConfig.addAttribute("option", LeftCurlyOption.NLOW.toString()); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputScopeInnerInterfaces.java"); final String[] expected = { "8:1: '{' should be on the previous line.", "12:5: '{' should be on the previous line.", @@ -51,6 +45,6 @@ public class TypeLeftCurlyCheckTest "30:5: '{' should be on the previous line.", "39:5: '{' should be on the previous line.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputScopeInnerInterfaces.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/TypeNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/TypeNameCheckTest.java similarity index 61% rename from src/tests/com/puppycrawl/tools/checkstyle/TypeNameCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/TypeNameCheckTest.java index a65c899a9..158aaa72d 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/TypeNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/TypeNameCheckTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.TypeNameCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class TypeNameCheckTest extends BaseCheckTestCase @@ -11,11 +12,9 @@ public class TypeNameCheckTest final DefaultConfiguration checkConfig = createCheckConfig(TypeNameCheck.class); checkConfig.addAttribute("format", "^inputHe"); - final Checker c = createChecker(checkConfig); - final String fname = getPath("inputHeader.java"); final String[] expected = { }; - verify(c, fname, expected); + verify(checkConfig, getPath("inputHeader.java"), expected); } public void testDefault() @@ -23,11 +22,9 @@ public class TypeNameCheckTest { final DefaultConfiguration checkConfig = createCheckConfig(TypeNameCheck.class); - final Checker c = createChecker(checkConfig); - final String fname = getPath("inputHeader.java"); final String[] expected = { "1:48: Name 'inputHeader' must match pattern '^[A-Z][a-zA-Z0-9]*$'." }; - verify(c, fname, expected); + verify(checkConfig, getPath("inputHeader.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/UpperEllCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java similarity index 56% rename from src/tests/com/puppycrawl/tools/checkstyle/UpperEllCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java index 4b41c0340..789182545 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/UpperEllCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.UpperEllCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class UpperEllCheckTest extends BaseCheckTestCase @@ -10,11 +11,9 @@ public class UpperEllCheckTest { final DefaultConfiguration checkConfig = createCheckConfig(UpperEllCheck.class); - final Checker c = createChecker(checkConfig); - final String fname = getPath("InputSemantic.java"); final String[] expected = { "94:43: Should use uppercase 'L'.", }; - verify(c, fname, expected); + verify(checkConfig, getPath("InputSemantic.java"), expected); } }