From 5190c8f656ae194fe8dc5be6a11ec95cf5aaf016 Mon Sep 17 00:00:00 2001 From: Oliver Burn Date: Sat, 7 Dec 2002 13:34:49 +0000 Subject: [PATCH] Refactoring to put the unit tests for the checks into the proper package. Side note: Eclipse makes this refactoring very easy to do. As part of the move it performs all the CVS operations that are required for moving a file. I actually like the Eclipse support for CVS, I thought nothing would beat good old Emacs. --- src/tests/com/puppycrawl/tools/checkstyle/AllTests.java | 1 + .../puppycrawl/tools/checkstyle/BaseCheckTestCase.java | 6 ++++++ .../{ => checks}/GenericIllegalRegexpCheckTest.java | 8 ++++---- 3 files changed, 11 insertions(+), 4 deletions(-) rename src/tests/com/puppycrawl/tools/checkstyle/{ => checks}/GenericIllegalRegexpCheckTest.java (72%) diff --git a/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java b/src/tests/com/puppycrawl/tools/checkstyle/AllTests.java index fc9beb640..1d1846f3d 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.GenericIllegalRegexpCheckTest; import junit.framework.Test; import junit.framework.TestSuite; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/BaseCheckTestCase.java b/src/tests/com/puppycrawl/tools/checkstyle/BaseCheckTestCase.java index 64e0ef7a9..7fce2c3bd 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/BaseCheckTestCase.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/BaseCheckTestCase.java @@ -68,6 +68,12 @@ public abstract class BaseCheckTestCase return f.getCanonicalPath(); } + protected void verify(Configuration aConfig, String aFileName, String[] aExpected) + throws Exception + { + verify(createChecker(aConfig), aFileName, aFileName, aExpected); + } + protected void verify(Checker aC, String aFileName, String[] aExpected) throws Exception { diff --git a/src/tests/com/puppycrawl/tools/checkstyle/GenericIllegalRegexpCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheckTest.java similarity index 72% rename from src/tests/com/puppycrawl/tools/checkstyle/GenericIllegalRegexpCheckTest.java rename to src/tests/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheckTest.java index 25377a080..dd5df97e3 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/GenericIllegalRegexpCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/GenericIllegalRegexpCheckTest.java @@ -1,6 +1,7 @@ -package com.puppycrawl.tools.checkstyle; +package com.puppycrawl.tools.checkstyle.checks; -import com.puppycrawl.tools.checkstyle.checks.GenericIllegalRegexpCheck; +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; public class GenericIllegalRegexpCheckTest extends BaseCheckTestCase @@ -12,11 +13,10 @@ public class GenericIllegalRegexpCheckTest final DefaultConfiguration checkConfig = createCheckConfig(GenericIllegalRegexpCheck.class); checkConfig.addAttribute("format", illegal); - final Checker c = createChecker(checkConfig); final String fname = getPath("InputSemantic.java"); final String[] expected = { "69: Line matches the illegal pattern '" + illegal + "'." }; - verify(c, fname, expected); + verify(checkConfig, fname, expected); } }