diff --git a/ant-phase-verify.xml b/ant-phase-verify.xml index c11242ae8..2851eeb13 100755 --- a/ant-phase-verify.xml +++ b/ant-phase-verify.xml @@ -19,7 +19,7 @@ failureProperty="checkstyle.failure.property" > diff --git a/build.xml b/build.xml index 7e38f7f0e..29f38f3b2 100755 --- a/build.xml +++ b/build.xml @@ -29,7 +29,7 @@ failureProperty="checkstyle.failure.property" > diff --git a/src/tests/com/puppycrawl/tools/checkstyle/CheckerTest.java b/src/tests/com/puppycrawl/tools/checkstyle/CheckerTest.java index c0518062e..e5a9b9fc0 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/CheckerTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/CheckerTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle; import static org.junit.Assert.assertEquals; @@ -34,7 +52,7 @@ public class CheckerTest // let's take testinputs.dir String testinputs_dir = System.getProperty("testinputs.dir") .replace('/', File.separatorChar) - .replace('\\',File.separatorChar); + .replace('\\', File.separatorChar); if (!testinputs_dir.endsWith(File.separator)) { testinputs_dir += File.separator; @@ -48,7 +66,7 @@ public class CheckerTest @Test public void testDestroy() throws Exception { - final DebugChecker c= new DebugChecker(); + final DebugChecker c = new DebugChecker(); final DebugAuditAdapter aa = new DebugAuditAdapter(); c.addListener(aa); final DebugFilter f = new DebugFilter(); @@ -74,7 +92,7 @@ public class CheckerTest @Test public void testAddListener() throws Exception { - final DebugChecker c= new DebugChecker(); + final DebugChecker c = new DebugChecker(); final DebugAuditAdapter aa = new DebugAuditAdapter(); c.addListener(aa); @@ -105,7 +123,7 @@ public class CheckerTest @Test public void testRemoveListener() throws Exception { - final DebugChecker c= new DebugChecker(); + final DebugChecker c = new DebugChecker(); final DebugAuditAdapter aa = new DebugAuditAdapter(); final DebugAuditAdapter aa2 = new DebugAuditAdapter(); c.addListener(aa); @@ -145,27 +163,27 @@ public class CheckerTest @Test public void testAddFilter() throws Exception { - final DebugChecker c= new DebugChecker(); + final DebugChecker c = new DebugChecker(); final DebugFilter f = new DebugFilter(); c.addFilter(f); // Let's try fire some events - // we do not call filter in fireAuditStarted() (fix for 1080343) + // we do not call filter in fireAuditStarted() (fix for 1080343) // c.fireAuditStarted(); // assertTrue("Checker.fireAuditStarted() doesn't call filter", f.wasCalled()); - // we do not call filter in fireAuditFinished() (fix for 1080343) + // we do not call filter in fireAuditFinished() (fix for 1080343) // f.resetFilter(); // c.fireAuditFinished(); // assertTrue("Checker.fireAuditFinished() doesn't call filter", f.wasCalled()); - // we do not call filter in fireFileStarted() (fix for 1080343) + // we do not call filter in fireFileStarted() (fix for 1080343) // f.resetFilter(); // c.fireFileStarted("Some File Name"); // assertTrue("Checker.fireFileStarted() doesn't call filter", f.wasCalled()); - // we do not call filter in fireFileFinished() (fix for 1080343) + // we do not call filter in fireFileFinished() (fix for 1080343) // f.resetFilter(); // c.fireFileFinished("Some File Name"); // assertTrue("Checker.fireFileFinished() doesn't call filter", f.wasCalled()); @@ -181,7 +199,7 @@ public class CheckerTest @Test public void testRemoveFilter() throws Exception { - final DebugChecker c= new DebugChecker(); + final DebugChecker c = new DebugChecker(); final DebugFilter f = new DebugFilter(); final DebugFilter f2 = new DebugFilter(); c.addFilter(f); @@ -189,24 +207,24 @@ public class CheckerTest c.removeFilter(f); // Let's try fire some events - // we do call filter in fireErrors() only (fix for 1080343) -// c.fireAuditStarted(); + // we do call filter in fireErrors() only (fix for 1080343) +// c.fireAuditStarted(); // assertTrue("Checker.fireAuditStarted() doesn't call filter", f2.wasCalled()); // assertFalse("Checker.fireAuditStarted() does call removed filter", f.wasCalled()); - // we do call filter in fireErrors() only (fix for 1080343) + // we do call filter in fireErrors() only (fix for 1080343) // f2.resetFilter(); // c.fireAuditFinished(); // assertTrue("Checker.fireAuditFinished() doesn't call filter", f2.wasCalled()); // assertFalse("Checker.fireAuditFinished() does call removed filter", f.wasCalled()); - // we do call filter in fireErrors() only (fix for 1080343) + // we do call filter in fireErrors() only (fix for 1080343) // f2.resetFilter(); // c.fireFileStarted("Some File Name"); // assertTrue("Checker.fireFileStarted() doesn't call filter", f2.wasCalled()); // assertFalse("Checker.fireFileStarted() does call removed filter", f.wasCalled()); - // we do call filter in fireErrors() only (fix for 1080343) + // we do call filter in fireErrors() only (fix for 1080343) // f2.resetFilter(); // c.fireFileFinished("Some File Name"); // assertTrue("Checker.fireFileFinished() doesn't call filter", f2.wasCalled()); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java b/src/tests/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java index 94afd0f51..3e774a011 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle; import static org.junit.Assert.assertEquals; @@ -199,7 +217,7 @@ public class ConfigurationLoaderTest throws CheckstyleException { final String[] testValues = {null, "", "a", "$a", "{a", - "{a}", "a}", "$a}", "$", "a$b"}; + "{a}", "a}", "$a}", "$", "a$b", }; final Properties props = initProperties(); for (int i = 0; i < testValues.length; i++) { final String value = ConfigurationLoader.replaceProperties( @@ -253,7 +271,7 @@ public class ConfigurationLoaderTest {"x${a}${b}y", "xABy"}, {"x${a}y${b}z", "xAyBz"}, {"$$", "$"}, - }; + }; final Properties props = initProperties(); for (int i = 0; i < testValues.length; i++) { final String value = ConfigurationLoader.replaceProperties( @@ -309,8 +327,8 @@ public class ConfigurationLoaderTest final Properties props = new Properties(); props.put("checkstyle.basedir", "basedir"); - final File file = new File(System.getProperty("testinputs.dir") + - "/configs/subdir/including.xml"); + final File file = new File(System.getProperty("testinputs.dir") + + "/configs/subdir/including.xml"); final DefaultConfiguration config = (DefaultConfiguration) ConfigurationLoader.loadConfiguration( file.toURI().toString(), new PropertiesExpander(props)); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java b/src/tests/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java index 579ffd45d..da24f3ae8 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle; import static org.junit.Assert.assertEquals; @@ -19,7 +37,7 @@ public class PackageNamesLoaderTest public void testDefault() throws CheckstyleException { - Set packageNames = PackageNamesLoader + final Set packageNames = PackageNamesLoader .getPackageNames(Thread.currentThread() .getContextClassLoader()); validatePackageNames(packageNames); @@ -51,7 +69,7 @@ public class PackageNamesLoaderTest assertEquals("pkgNames.length.", checkstylePackages.length, aPkgNames.size()); - Set checkstylePackagesSet = + final Set checkstylePackagesSet = Sets.newHashSet(Arrays.asList(checkstylePackages)); assertEquals("names set.", checkstylePackagesSet, aPkgNames); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java b/src/tests/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java index 89ec624bf..c89806b09 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/PackageObjectFactoryTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/UtilsTest.java b/src/tests/com/puppycrawl/tools/checkstyle/UtilsTest.java index ec3d733f0..4c242f38e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/UtilsTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/UtilsTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle; import static org.junit.Assert.assertEquals; @@ -16,16 +34,16 @@ public class UtilsTest public void testLengthExpandedTabs() throws Exception { - String s1 = "\t"; + final String s1 = "\t"; assertEquals(8, Utils.lengthExpandedTabs(s1, s1.length(), 8)); - String s2 = " \t"; + final String s2 = " \t"; assertEquals(8, Utils.lengthExpandedTabs(s2, s2.length(), 8)); - String s3 = "\t\t"; + final String s3 = "\t\t"; assertEquals(16, Utils.lengthExpandedTabs(s3, s3.length(), 8)); - String s4 = " \t "; + final String s4 = " \t "; assertEquals(9, Utils.lengthExpandedTabs(s4, s4.length(), 8)); assertEquals(0, Utils.lengthMinusTrailingWhitespace("")); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java b/src/tests/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java index 3fba9bf69..bfcf389b1 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle; import static org.junit.Assert.assertEquals; @@ -78,7 +96,7 @@ public class XMLLoggerTest outStream.close(); } - @Test + @Test public void testCloseStream() throws IOException { @@ -128,7 +146,8 @@ public class XMLLoggerTest } @Test - public void testAddError() throws IOException { + public void testAddError() throws IOException + { final XMLLogger logger = new XMLLogger(outStream, true); logger.auditStarted(null); final LocalizedMessage message = @@ -138,8 +157,9 @@ public class XMLLoggerTest final AuditEvent ev = new AuditEvent(this, "Test.java", message); logger.addError(ev); logger.auditFinished(null); - final String[] expectedLines = - {""}; + final String[] expectedLines = { + "", + }; verifyLines(expectedLines); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java b/src/tests/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java index 4f6536f82..fa25085a9 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporterTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.api; import static org.junit.Assert.assertEquals; @@ -76,7 +94,7 @@ public class AbstractViolationReporterTest extends BaseCheckTestSupport messages.first().getMessage()); } - @Test(expected=IllegalArgumentException.class) + @Test(expected = IllegalArgumentException.class) public void testCustomMessageWithParametersNegative() throws CheckstyleException { DefaultConfiguration config = createCheckConfig(emptyCheck.getClass()); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/api/AutomaticBeanTest.java b/src/tests/com/puppycrawl/tools/checkstyle/api/AutomaticBeanTest.java index d1b82bc2e..3b5c158f1 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/api/AutomaticBeanTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/api/AutomaticBeanTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.api; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; @@ -15,7 +33,7 @@ public class AutomaticBeanTest private final DefaultConfiguration mConf = new DefaultConfiguration( "testConf"); - TestBean mTestBean = new TestBean(); + private final TestBean mTestBean = new TestBean(); @Test(expected = CheckstyleException.class) public void testNoSuchAttribute() throws CheckstyleException diff --git a/src/tests/com/puppycrawl/tools/checkstyle/api/DetailASTTest.java b/src/tests/com/puppycrawl/tools/checkstyle/api/DetailASTTest.java index 1f2359d4d..b6cdea141 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/api/DetailASTTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/api/DetailASTTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.api; import static org.junit.Assert.assertEquals; @@ -15,7 +33,8 @@ import org.junit.Test; public class DetailASTTest { @Test - public void testGetChildCount() { + public void testGetChildCount() + { final DetailAST root = new DetailAST(); final DetailAST firstLevelA = new DetailAST(); final DetailAST firstLevelB = new DetailAST(); @@ -52,7 +71,8 @@ public class DetailASTTest private void checkDir(File dir) throws Exception { File[] files = dir.listFiles(new FileFilter() { - public boolean accept(File file) { + public boolean accept(File file) + { return (file.getName().endsWith(".java") || file.isDirectory()) && !file.getName().endsWith("InputGrammar.java"); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/api/FastStackTest.java b/src/tests/com/puppycrawl/tools/checkstyle/api/FastStackTest.java index 34c5162ce..bd3b17a58 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/api/FastStackTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/api/FastStackTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.api; import static org.junit.Assert.assertEquals; @@ -29,8 +47,7 @@ public class FastStackTest assertTrue(fs.isEmpty()); assertEquals(0, fs.size()); final int num = 100; - for (int i = 0; i < num; i++) - { + for (int i = 0; i < num; i++) { fs.push(i); } assertEquals(num, fs.size()); @@ -38,8 +55,7 @@ public class FastStackTest assertEquals(1, fs.peek(1).intValue()); assertEquals(num - 1, fs.peek().intValue()); assertEquals(num, fs.size()); - for (int i = 0; i < num; i++) - { + for (int i = 0; i < num; i++) { fs.pop(); } assertTrue(fs.isEmpty()); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/api/ScopeTest.java b/src/tests/com/puppycrawl/tools/checkstyle/api/ScopeTest.java index 682b27ca3..61f95c612 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/api/ScopeTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/api/ScopeTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.api; import static org.junit.Assert.*; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/api/SeverityLevelTest.java b/src/tests/com/puppycrawl/tools/checkstyle/api/SeverityLevelTest.java index 387143def..c08a02d35 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/api/SeverityLevelTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/api/SeverityLevelTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.api; import static org.junit.Assert.*; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/api/TokenTypesTest.java b/src/tests/com/puppycrawl/tools/checkstyle/api/TokenTypesTest.java index aee5dd67d..e93ec1b8e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/api/TokenTypesTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/api/TokenTypesTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.api; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheckTest.java index 3e413587d..0cca7f77e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/ClassResolverTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/ClassResolverTest.java index b51da2ca2..7c2d1747c 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/ClassResolverTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/ClassResolverTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import static org.junit.Assert.assertNotNull; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java index ab8da13fe..b06818434 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -104,22 +122,22 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("maximumMessage", "Empty statement."); final String[] expected = { - "12:7: Empty statement.", - "17:7: Empty statement.", - "22:19: Empty statement.", - "26:10: Empty statement.", - "29:16: Empty statement.", - "33:10: Empty statement.", - "43:10: Empty statement.", - "49:13: Empty statement.", - "51:13: Empty statement.", - "54:19: Empty statement.", - "58:10: Empty statement.", - "61:9: Empty statement.", - "66:10: Empty statement.", - "72:10: Empty statement.", - "76:10: Empty statement.", - "80:10: Empty statement.", + "12:7: Empty statement.", + "17:7: Empty statement.", + "22:19: Empty statement.", + "26:10: Empty statement.", + "29:16: Empty statement.", + "33:10: Empty statement.", + "43:10: Empty statement.", + "49:13: Empty statement.", + "51:13: Empty statement.", + "54:19: Empty statement.", + "58:10: Empty statement.", + "61:9: Empty statement.", + "66:10: Empty statement.", + "72:10: Empty statement.", + "76:10: Empty statement.", + "80:10: Empty statement.", }; verify(checkConfig, getPath("InputEmptyStatement.java"), expected); @@ -183,20 +201,20 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport @Test public void testIllegalTokenNative() throws Exception - { - final DefaultConfiguration checkConfig = - createCheckConfig(DescendantTokenCheck.class); + { + final DefaultConfiguration checkConfig = + createCheckConfig(DescendantTokenCheck.class); checkConfig.addAttribute("tokens", "LITERAL_NATIVE"); checkConfig.addAttribute("limitedTokens", "LITERAL_NATIVE"); checkConfig.addAttribute("maximumNumber", "0"); checkConfig.addAttribute("maximumDepth", "0"); checkConfig.addAttribute("maximumMessage", "Using ''{2}'' is not allowed."); - final String[] expected = { - "20:12: Using 'LITERAL_NATIVE' is not allowed.", - }; - verify(checkConfig, getPath("InputIllegalTokens.java"), expected); - } + final String[] expected = { + "20:12: Using 'LITERAL_NATIVE' is not allowed.", + }; + verify(checkConfig, getPath("InputIllegalTokens.java"), expected); + } @Test public void testReturnFromCatch() throws Exception @@ -210,7 +228,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport String[] expected = { "7:11: Return from catch is not allowed.", - "15:11: Return from catch is not allowed." + "15:11: Return from catch is not allowed.", }; verify(checkConfig, @@ -230,7 +248,7 @@ public class DescendantTokenCheckTest extends BaseCheckTestSupport String[] expected = { "7:11: Return from finally is not allowed.", - "15:11: Return from finally is not allowed." + "15:11: Return from finally is not allowed.", }; verify(checkConfig, diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java index b30381608..d8aba9fc6 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/FileSetCheckLifecycleTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import static org.junit.Assert.assertTrue; @@ -23,7 +41,7 @@ public class FileSetCheckLifecycleTest public static class TestFileSetCheck extends AbstractFileSetCheck { - private static boolean destroyed = false; + private static boolean destroyed; @Override public void destroy() @@ -43,8 +61,7 @@ public class FileSetCheckLifecycleTest } @Test - public void testTranslation() - throws Exception + public void testTranslation() throws Exception { final Configuration checkConfig = createCheckConfig(TestFileSetCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheckTest.java index 41b1d12be..d37b0ac7f 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -7,8 +25,7 @@ import org.junit.Test; public class FinalParametersCheckTest extends BaseCheckTestSupport { @Test - public void testDefaultTokens() - throws Exception + public void testDefaultTokens() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(FinalParametersCheck.class); @@ -29,8 +46,7 @@ public class FinalParametersCheckTest extends BaseCheckTestSupport } @Test - public void testCtorToken() - throws Exception + public void testCtorToken() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(FinalParametersCheck.class); @@ -44,8 +60,7 @@ public class FinalParametersCheckTest extends BaseCheckTestSupport } @Test - public void testMethodToken() - throws Exception + public void testMethodToken() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(FinalParametersCheck.class); @@ -64,8 +79,7 @@ public class FinalParametersCheckTest extends BaseCheckTestSupport } @Test - public void testCatchToken() - throws Exception + public void testCatchToken() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(FinalParametersCheck.class); @@ -79,8 +93,7 @@ public class FinalParametersCheckTest extends BaseCheckTestSupport } @Test - public void testForEachClauseToken() - throws Exception + public void testForEachClauseToken() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(FinalParametersCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java index a1fb7b861..8b08750d6 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -19,13 +37,12 @@ public class NewlineAtEndOfFileCheckTest } @Test - public void testNewlineAtEndOfFile() - throws Exception + public void testNewlineAtEndOfFile() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NewlineAtEndOfFileCheck.class); checkConfig.addAttribute("lineSeparator", LineSeparatorOption.LF.toString()); - final String[] expected = { }; + final String[] expected = {}; verify( createChecker(checkConfig), getPath("InputNewlineAtEndOfFile.java"), @@ -33,14 +50,13 @@ public class NewlineAtEndOfFileCheckTest } @Test - public void testNoNewlineAtEndOfFile() - throws Exception + public void testNoNewlineAtEndOfFile() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NewlineAtEndOfFileCheck.class); checkConfig.addAttribute("lineSeparator", LineSeparatorOption.LF.toString()); final String[] expected = { - "0: File does not end with a newline." + "0: File does not end with a newline.", }; verify( createChecker(checkConfig), @@ -48,7 +64,7 @@ public class NewlineAtEndOfFileCheckTest expected); } - @Test(expected=CheckstyleException.class) + @Test(expected = CheckstyleException.class) public void testSetLineSeparatorFailure() throws Exception { @@ -59,14 +75,13 @@ public class NewlineAtEndOfFileCheckTest } @Test - public void testEmptyFileFile() - throws Exception + public void testEmptyFileFile() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NewlineAtEndOfFileCheck.class); checkConfig.addAttribute("lineSeparator", LineSeparatorOption.LF.toString()); final String[] expected = { - "0: File does not end with a newline." + "0: File does not end with a newline.", }; verify( createChecker(checkConfig), diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java index 90411e966..62f6a51eb 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheckTest.java @@ -1,28 +1,47 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; -public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport { +public class OuterTypeFilenameCheckTest extends BaseCheckTestSupport +{ @Test - public void testGood() throws Exception { + public void testGood() throws Exception + { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class); final String[] expected = {}; verify(checkConfig, getPath("InputIllegalTokens.java"), expected); } @Test - public void testBad() throws Exception { + public void testBad() throws Exception + { final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeFilenameCheck.class); final String[] expected = { - "3: The name of the outer type and the file do not match." + "3: The name of the outer type and the file do not match.", }; verify(checkConfig, getPath("Input15Extensions.java"), expected); } -} \ No newline at end of file +} diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/RegexpCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/RegexpCheckTest.java index 8bc50ad70..889d8a096 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/RegexpCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/RegexpCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -7,8 +25,7 @@ import org.junit.Test; public class RegexpCheckTest extends BaseCheckTestSupport { @Test - public void testRequiredPass() - throws Exception + public void testRequiredPass() throws Exception { final String required = "Test case file"; final DefaultConfiguration checkConfig = @@ -20,22 +37,20 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testRequiredFail() - throws Exception + public void testRequiredFail() throws Exception { final String required = "This text is not in the file"; final DefaultConfiguration checkConfig = createCheckConfig(RegexpCheck.class); checkConfig.addAttribute("format", required); final String[] expected = { - "0: Required pattern '" + required + "' missing in file." + "0: Required pattern '" + required + "' missing in file.", }; verify(checkConfig, getPath("InputSemantic.java"), expected); } @Test - public void testRequiredNoDuplicatesPass() - throws Exception + public void testRequiredNoDuplicatesPass() throws Exception { final String required = "Test case file"; final DefaultConfiguration checkConfig = @@ -48,8 +63,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testRequiredNoDuplicatesFail() - throws Exception + public void testRequiredNoDuplicatesFail() throws Exception { final String required = "Boolean x = new Boolean"; final DefaultConfiguration checkConfig = @@ -57,14 +71,13 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("format", required); checkConfig.addAttribute("duplicateLimit", "0"); final String[] expected = { - "24: Found duplicate pattern '" + required + "'." + "24: Found duplicate pattern '" + required + "'.", }; verify(checkConfig, getPath("InputSemantic.java"), expected); } @Test - public void testIllegalPass() - throws Exception + public void testIllegalPass() throws Exception { final String illegal = "This text is not in the file"; final DefaultConfiguration checkConfig = @@ -77,8 +90,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testIllegalFailBelowErrorLimit() - throws Exception + public void testIllegalFailBelowErrorLimit() throws Exception { final String illegal = "^import"; final DefaultConfiguration checkConfig = @@ -89,18 +101,17 @@ public class RegexpCheckTest extends BaseCheckTestSupport final String[] expected = { "7: Line matches the illegal pattern '" + illegal + "'.", "8: Line matches the illegal pattern '" + illegal + "'.", - "9: Line matches the illegal pattern '" + illegal + "'." + "9: Line matches the illegal pattern '" + illegal + "'.", }; verify(checkConfig, getPath("InputSemantic.java"), expected); } @Test - public void testIllegalFailAboveErrorLimit() - throws Exception + public void testIllegalFailAboveErrorLimit() throws Exception { final String illegal = "^import"; final String error = "The error limit has been exceeded, " - + "the check is aborting, there may be more unreported errors."; + + "the check is aborting, there may be more unreported errors."; final DefaultConfiguration checkConfig = createCheckConfig(RegexpCheck.class); checkConfig.addAttribute("format", illegal); @@ -109,7 +120,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport final String[] expected = { "7: Line matches the illegal pattern '" + illegal + "'.", "8: Line matches the illegal pattern '" + illegal + "'.", - "9: Line matches the illegal pattern '" + error + illegal + "'." + "9: Line matches the illegal pattern '" + error + illegal + "'.", }; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -126,7 +137,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("message", message); final String[] expected = { - "69: Line matches the illegal pattern '" + message + "'." + "69: Line matches the illegal pattern '" + message + "'.", }; verify(checkConfig, getPath("InputSemantic.java"), expected); } @@ -142,14 +153,13 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("message", null); final String[] expected = { - "69: Line matches the illegal pattern '" + illegal + "'." + "69: Line matches the illegal pattern '" + illegal + "'.", }; verify(checkConfig, getPath("InputSemantic.java"), expected); } @Test - public void testIgnoreCaseTrue() - throws Exception + public void testIgnoreCaseTrue() throws Exception { final String illegal = "(?i)SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; final DefaultConfiguration checkConfig = @@ -157,14 +167,13 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("format", illegal); checkConfig.addAttribute("illegalPattern", "true"); final String[] expected = { - "69: Line matches the illegal pattern '" + illegal + "'." + "69: Line matches the illegal pattern '" + illegal + "'.", }; verify(checkConfig, getPath("InputSemantic.java"), expected); } @Test - public void testIgnoreCaseFalse() - throws Exception + public void testIgnoreCaseFalse() throws Exception { final String illegalTrue = "(?i)SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; final DefaultConfiguration checkConfigTrue = @@ -172,7 +181,8 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfigTrue.addAttribute("format", illegalTrue); checkConfigTrue.addAttribute("illegalPattern", "true"); final String[] expectedTrue = { - "69: Line matches the illegal pattern '" + illegalTrue + "'."}; + "69: Line matches the illegal pattern '" + illegalTrue + "'.", + }; verify(checkConfigTrue, getPath("InputSemantic.java"), expectedTrue); final String illegalFalse = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; @@ -185,8 +195,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsCppStyle() - throws Exception + public void testIgnoreCommentsCppStyle() throws Exception { // See if the comment is removed properly final String illegal = "don't use trailing comments"; @@ -201,8 +210,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsFalseCppStyle() - throws Exception + public void testIgnoreCommentsFalseCppStyle() throws Exception { // See if the comment is removed properly final String illegal = "don't use trailing comments"; @@ -212,14 +220,13 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "false"); final String[] expected = { - "2: Line matches the illegal pattern '" + illegal + "'." + "2: Line matches the illegal pattern '" + illegal + "'.", }; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @Test - public void testIgnoreCommentsCStyle() - throws Exception + public void testIgnoreCommentsCStyle() throws Exception { // See if the comment is removed properly final String illegal = "c-style 1"; @@ -234,8 +241,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsFalseCStyle() - throws Exception + public void testIgnoreCommentsFalseCStyle() throws Exception { final String illegal = "c-style 1"; final DefaultConfiguration checkConfig = @@ -244,14 +250,13 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "false"); final String[] expected = { - "17: Line matches the illegal pattern '" + illegal + "'." + "17: Line matches the illegal pattern '" + illegal + "'.", }; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @Test - public void testIgnoreCommentsMultipleCStyle() - throws Exception + public void testIgnoreCommentsMultipleCStyle() throws Exception { // See if a second comment on the same line is removed properly final String illegal = "c-style 2"; @@ -266,8 +271,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsMultiLine() - throws Exception + public void testIgnoreCommentsMultiLine() throws Exception { final String illegal = "Let's check multi-line comments"; final DefaultConfiguration checkConfig = @@ -281,8 +285,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsInlineStart() - throws Exception + public void testIgnoreCommentsInlineStart() throws Exception { final String illegal = "long ms /"; final DefaultConfiguration checkConfig = @@ -296,8 +299,7 @@ public class RegexpCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsInlineEnd() - throws Exception + public void testIgnoreCommentsInlineEnd() throws Exception { final String illegal = "int z"; final DefaultConfiguration checkConfig = @@ -306,14 +308,13 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "true"); final String[] expected = { - "20: Line matches the illegal pattern '" + illegal + "'." + "20: Line matches the illegal pattern '" + illegal + "'.", }; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @Test - public void testIgnoreCommentsInlineMiddle() - throws Exception + public void testIgnoreCommentsInlineMiddle() throws Exception { final String illegal = "int y"; final DefaultConfiguration checkConfig = @@ -322,14 +323,13 @@ public class RegexpCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("illegalPattern", "true"); checkConfig.addAttribute("ignoreComments", "true"); final String[] expected = { - "21: Line matches the illegal pattern '" + illegal + "'." + "21: Line matches the illegal pattern '" + illegal + "'.", }; verify(checkConfig, getPath("InputTrailingComment.java"), expected); } @Test - public void testIgnoreCommentsNoSpaces() - throws Exception + public void testIgnoreCommentsNoSpaces() throws Exception { // make sure the comment is not turned into spaces final String illegal = "long ms "; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheckTest.java index b2ec3e80a..43acf05ad 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,8 +26,7 @@ public class TodoCommentCheckTest extends BaseCheckTestSupport { @Test - public void testIt() - throws Exception + public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(TodoCommentCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java index f0fa97d24..e07d2bc50 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -7,10 +25,11 @@ import org.junit.Test; public class TrailingCommentCheckTest extends BaseCheckTestSupport { - DefaultConfiguration mCheckConfig; + private DefaultConfiguration mCheckConfig; @Before - public void setUp() { + public void setUp() + { mCheckConfig = createCheckConfig(TrailingCommentCheck.class); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java index 3249e887d..467ef6ec9 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -19,16 +37,15 @@ public class TranslationCheckTest } @Test - public void testTranslation() - throws Exception + public void testTranslation() throws Exception { final Configuration checkConfig = createCheckConfig(TranslationCheck.class); final String[] expected = { - "0: Key 'only.english' missing." + "0: Key 'only.english' missing.", }; final File[] propertyFiles = new File[] { new File(getPath("messages_de.properties")), - new File(getPath("messages.properties")) + new File(getPath("messages.properties")), }; verify( createChecker(checkConfig), diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java index cf4e6a30f..b5413307e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java index 4db63e66a..42698b8b5 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleTest.java index 3a0d692ae..eabb547a9 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.annotation; import java.io.File; @@ -12,7 +30,8 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport * @throws Exception */ @Test - public void testParansAlways() throws Exception { + public void testParansAlways() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ALWAYS"); checkConfig.addAttribute("elementStyle", "ignore"); @@ -25,13 +44,14 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "DifferentUseStyles.java"), expected); } - + /** * Test that annotation parens are never present. * @throws Exception */ @Test - public void testParansNever() throws Exception { + public void testParansNever() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "NEVER"); checkConfig.addAttribute("elementStyle", "ignore"); @@ -45,13 +65,9 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "DifferentUseStyles.java"), expected); } - /** - * Tests that annotation is always in expanded style. - * @throws Exception - */ @Test - public void testStyleExpanded() throws Exception { - + public void testStyleExpanded() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "EXPANDED"); @@ -68,13 +84,10 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "DifferentUseStyles.java"), expected); } - - /** - * Tests that annotation is always in compact style. - * @throws Exception - */ + @Test - public void testStyleCompact() throws Exception { + public void testStyleCompact() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "COMPACT"); @@ -86,13 +99,10 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "DifferentUseStyles.java"), expected); } - - /** - * Tests that annotation is always in compact no array style. - * @throws Exception - */ + @Test - public void testStyleCompactNoArray() throws Exception { + public void testStyleCompactNoArray() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "COMPACT_NO_ARRAY"); @@ -107,9 +117,10 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "DifferentUseStyles.java"), expected); } - + @Test - public void testCommaAlwaysViolations() throws Exception { + public void testCommaAlwaysViolations() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "ignore"); @@ -132,9 +143,10 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "AnnotationUseNoTrailingComma.java"), expected); } - + @Test - public void testCommaAlwaysNoViolations() throws Exception { + public void testCommaAlwaysNoViolations() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "ignore"); @@ -144,9 +156,10 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "AnnotationUseWithTrailingComma.java"), expected); } - + @Test - public void testCommaNeverViolations() throws Exception { + public void testCommaNeverViolations() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "ignore"); @@ -164,9 +177,10 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "AnnotationUseWithTrailingComma.java"), expected); } - + @Test - public void testCommaNeverNoViolations() throws Exception { + public void testCommaNeverNoViolations() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "ignore"); @@ -176,9 +190,10 @@ public class AnnotationUseStyleTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "AnnotationUseNoTrailingComma.java"), expected); } - + @Test - public void testEverythingMixed() throws Exception { + public void testEverythingMixed() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(AnnotationUseStyleCheck.class); checkConfig.addAttribute("closingParens", "ignore"); checkConfig.addAttribute("elementStyle", "ignore"); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedTest.java index e2a04690b..01b201b56 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.annotation; import java.io.File; @@ -13,10 +31,10 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport * Tests that memebers that are only deprecated via javadoc are flagged. */ @Test - public void testBadDeprecatedAnnotation() throws Exception { - + public void testBadDeprecatedAnnotation() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(MissingDeprecatedCheck.class); - + final String[] expected = { "7: Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description.", "12: Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description.", @@ -31,15 +49,16 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "BadDeprecatedAnnotation.java"), expected); } - + /** * Tests that memebers that are only deprecated via the annotation are flagged. */ @Test - public void testBadDeprecatedJavadoc() throws Exception { - + public void testBadDeprecatedJavadoc() throws Exception + { + DefaultConfiguration checkConfig = createCheckConfig(MissingDeprecatedCheck.class); - + final String[] expected = { "5: Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description.", "11: Must include both @java.lang.Deprecated annotation and @deprecated Javadoc tag with description.", @@ -54,15 +73,16 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "BadDeprecatedJavadoc.java"), expected); } - + /** * Tests various special deprecation conditions such as duplicate or empty tags. */ @Test - public void testSpecialCaseDeprecated() throws Exception { - + public void testSpecialCaseDeprecated() throws Exception + { + DefaultConfiguration checkConfig = createCheckConfig(MissingDeprecatedCheck.class); - + final String[] expected = { "5: Duplicate @deprecated tag.", "12: Duplicate @deprecated tag.", @@ -81,15 +101,16 @@ public class MissingDeprecatedTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SpecialCaseDeprecated.java"), expected); } - + /** * Tests that good forms of deprecation are not flagged. */ @Test - public void testGoodDeprecated() throws Exception { - + public void testGoodDeprecated() throws Exception + { + DefaultConfiguration checkConfig = createCheckConfig(MissingDeprecatedCheck.class); - + final String[] expected = { }; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckTest.java index 9bbd25b08..6b6572a12 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.annotation; import java.io.File; @@ -8,7 +26,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import org.junit.Test; public class MissingOverrideCheckTest extends BaseCheckTestSupport -{ +{ /** * This tests that classes not extending anything explicitly will be correctly * flagged for only including the inheritDoc tag. @@ -19,7 +37,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "false"); - + final String[] expected = { "8: Must include @java.lang.Override annotation when {@inheritDoc} Javadoc tag exists.", "30: Must include @java.lang.Override annotation when {@inheritDoc} Javadoc tag exists.", @@ -29,7 +47,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromObject.java"), expected); } - + /** * This tests that classes not extending anything explicitly will be correctly * flagged for only including the inheritDoc tag even in Java 5 compatibility mode. @@ -40,7 +58,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - + final String[] expected = { "8: Must include @java.lang.Override annotation when {@inheritDoc} Javadoc tag exists.", "30: Must include @java.lang.Override annotation when {@inheritDoc} Javadoc tag exists.", @@ -50,7 +68,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromObject.java"), expected); } - + /** * This tests classes that are extending things explicitly will be correctly * flagged for only including the inheritDoc tag. @@ -72,7 +90,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromOther.java"), expected); } - + /** * This tests classes that are extending things explicitly will NOT be flagged while in * Java 5 compatibility mode. @@ -83,13 +101,13 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - + final String[] expected = { }; verify(checkConfig, getPath("annotation" + File.separator + "BadOverrideFromOther.java"), expected); } - + /** * This tests anonymous inner classes that are overriding methods are correctly flagged * for only including the inheritDoc tag. @@ -108,7 +126,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "BadAnnonOverride.java"), expected); } - + /** * This tests anonymous inner classes that are overriding methods are NOT flagged while in * Java 5 compatibility mode. @@ -124,13 +142,14 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "BadAnnonOverride.java"), expected); } - + /** * Tests that inheritDoc misuse is properly flagged or missing Javadocs do not cause a problem. * @throws Exception */ @Test - public void testNotOverride() throws Exception { + public void testNotOverride() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); final String[] expected = { "8: The Javadoc {@inheritDoc} tag is not valid at this location.", @@ -141,7 +160,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "NotOverride.java"), expected); } - + /** * This tests that classes not extending anything explicitly will be correctly * flagged for only including the inheritDoc tag. @@ -152,13 +171,13 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "false"); - + final String[] expected = { }; verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromObject.java"), expected); } - + /** * This tests that classes not extending anything explicitly will be correctly * flagged for only including the inheritDoc tag even in Java 5 compatibility mode. @@ -169,13 +188,13 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - + final String[] expected = { }; verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromObject.java"), expected); } - + /** * This tests classes that are extending things explicitly will be correctly * flagged for only including the inheritDoc tag. @@ -190,7 +209,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromOther.java"), expected); } - + /** * This tests classes that are extending things explicitly will NOT be flagged while in * Java 5 compatibility mode. @@ -201,13 +220,13 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport { DefaultConfiguration checkConfig = createCheckConfig(MissingOverrideCheck.class); checkConfig.addAttribute("javaFiveCompatibility", "true"); - + final String[] expected = { }; verify(checkConfig, getPath("annotation" + File.separator + "GoodOverrideFromOther.java"), expected); } - + /** * This tests anonymous inner classes that are overriding methods are correctly flagged * for only including the inheritDoc tag. @@ -222,7 +241,7 @@ public class MissingOverrideCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "GoodAnnonOverride.java"), expected); } - + /** * This tests anonymous inner classes that are overriding methods are NOT flagged while in * Java 5 compatibility mode. diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationTest.java index 0ebbcd01f..3640f6d64 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.annotation; import java.io.File; @@ -9,48 +27,48 @@ public class PackageAnnotationTest extends BaseCheckTestSupport { /** * This tests 1 package annotation that is not in the package-info.java file. - * + * * @throws Exception */ @Test public void testBadPackageAnnotation1() throws Exception { DefaultConfiguration checkConfig = createCheckConfig(PackageAnnotationCheck.class); - + final String[] expected = { "0: Package annotations must be in the package-info.java info.", }; verify(checkConfig, getPath("annotation" + File.separator + "BadPackageAnnotation1.java"), expected); } - + /** * This tests 2 package annotations that are not in the package-info.java file. - * + * * @throws Exception */ @Test public void testBadPackageAnnotation2() throws Exception { DefaultConfiguration checkConfig = createCheckConfig(PackageAnnotationCheck.class); - + final String[] expected = { "0: Package annotations must be in the package-info.java info.", }; verify(checkConfig, getPath("annotation" + File.separator + "BadPackageAnnotation2.java"), expected); } - + /** * This tests a package annotation that is in the package-info.java file. - * + * * @throws Exception */ @Test public void testGoodPackageAnnotation() throws Exception { DefaultConfiguration checkConfig = createCheckConfig(PackageAnnotationCheck.class); - + final String[] expected = { }; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsTest.java index 612d227f9..93e70f99c 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsTest.java @@ -1,11 +1,27 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.annotation; -import java.io.File; - -import org.junit.Test; - import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import java.io.File; +import org.junit.Test; public class SuppressWarningsTest extends BaseCheckTestSupport { @@ -14,9 +30,10 @@ public class SuppressWarningsTest extends BaseCheckTestSupport * @throws Exception */ @Test - public void testSingleDefault() throws Exception { + public void testSingleDefault() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); - + final String[] expected = { "8:23: The warning ' ' cannot be suppressed at this location.", "11:27: The warning '' cannot be suppressed at this location.", @@ -31,16 +48,17 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsSingle.java"), expected); } - + /** * Tests SuppressWarnings all warnings disabled on everything. * @throws Exception */ @Test - public void testSingleAll() throws Exception { + public void testSingleAll() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", ".*"); - + final String[] expected = { "5:19: The warning 'unchecked' cannot be suppressed at this location.", "8:23: The warning ' ' cannot be suppressed at this location.", @@ -80,16 +98,17 @@ public class SuppressWarningsTest extends BaseCheckTestSupport * @throws Exception */ @Test - public void testSingleNoUnchecked() throws Exception { + public void testSingleNoUnchecked() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*"); - + final String[] expected = { "5:19: The warning 'unchecked' cannot be suppressed at this location.", "29:35: The warning 'unchecked' cannot be suppressed at this location.", "56:27: The warning 'unchecked' cannot be suppressed at this location.", "59:48: The warning 'unchecked' cannot be suppressed at this location.", - + "64:33: The warning 'unchecked' cannot be suppressed at this location.", "67:42: The warning 'unchecked' cannot be suppressed at this location.", "72:65: The warning 'unchecked' cannot be suppressed at this location.", @@ -99,21 +118,22 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsSingle.java"), expected); } - + /** * Tests SuppressWarnings unchecked warning disabled on certain tokens. * @throws Exception */ @Test - public void testSingleNoUncheckedTokens() throws Exception { + public void testSingleNoUncheckedTokens() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*"); checkConfig.addAttribute("tokens", "CLASS_DEF,METHOD_DEF"); - + final String[] expected = { "5:19: The warning 'unchecked' cannot be suppressed at this location.", "29:35: The warning 'unchecked' cannot be suppressed at this location.", - + "64:33: The warning 'unchecked' cannot be suppressed at this location.", "72:65: The warning 'unchecked' cannot be suppressed at this location.", "77:37: The warning 'unchecked' cannot be suppressed at this location.", @@ -128,10 +148,11 @@ public class SuppressWarningsTest extends BaseCheckTestSupport * @throws Exception */ @Test - public void testSingleNoUnWildcard() throws Exception { + public void testSingleNoUnWildcard() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", ".*un.*"); - + final String[] expected = { "5:19: The warning 'unchecked' cannot be suppressed at this location.", "17:23: The warning 'unused' cannot be suppressed at this location.", @@ -143,7 +164,7 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "47:27: The warning 'unused' cannot be suppressed at this location.", "56:27: The warning 'unchecked' cannot be suppressed at this location.", "59:48: The warning 'unchecked' cannot be suppressed at this location.", - + "64:33: The warning 'unchecked' cannot be suppressed at this location.", "67:42: The warning 'unchecked' cannot be suppressed at this location.", "72:54: The warning 'unused' cannot be suppressed at this location.", @@ -156,16 +177,17 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsSingle.java"), expected); } - + /** * Tests SuppressWarnings unchecked, unused warning disabled on everything. * @throws Exception */ @Test - public void testSingleNoUncheckedUnused() throws Exception { + public void testSingleNoUncheckedUnused() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*|^unused$"); - + final String[] expected = { "5:19: The warning 'unchecked' cannot be suppressed at this location.", "17:23: The warning 'unused' cannot be suppressed at this location.", @@ -174,7 +196,7 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "47:27: The warning 'unused' cannot be suppressed at this location.", "56:27: The warning 'unchecked' cannot be suppressed at this location.", "59:48: The warning 'unchecked' cannot be suppressed at this location.", - + "64:33: The warning 'unchecked' cannot be suppressed at this location.", "67:42: The warning 'unchecked' cannot be suppressed at this location.", "72:54: The warning 'unused' cannot be suppressed at this location.", @@ -187,16 +209,17 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsSingle.java"), expected); } - + /** * Tests SuppressWarnings *, unchecked, unused warning disabled on everything. * @throws Exception */ @Test - public void testSingleNoUncheckedUnusedAll() throws Exception { + public void testSingleNoUncheckedUnusedAll() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*|^unused$*|.*"); - + final String[] expected = { "5:19: The warning 'unchecked' cannot be suppressed at this location.", "8:23: The warning ' ' cannot be suppressed at this location.", @@ -230,24 +253,25 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsSingle.java"), expected); } - + /** * Tests SuppressWarnings with default regex. * @throws Exception */ @Test - public void testCompactDefault() throws Exception { + public void testCompactDefault() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); - + final String[] expected = { "8:24: The warning ' ' cannot be suppressed at this location.", "11:41: The warning '' cannot be suppressed at this location.", "44:23: The warning '' cannot be suppressed at this location.", "53:27: The warning '' cannot be suppressed at this location.", - + "64:48: The warning '' cannot be suppressed at this location.", "64:76: The warning '' cannot be suppressed at this location.", - + "67:38: The warning '' cannot be suppressed at this location.", "72:47: The warning ' ' cannot be suppressed at this location.", "72:98: The warning ' ' cannot be suppressed at this location.", @@ -260,16 +284,17 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsCompact.java"), expected); } - + /** * Tests SuppressWarnings all warnings disabled on everything. * @throws Exception */ @Test - public void testCompactAll() throws Exception { + public void testCompactAll() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", ".*"); - + final String[] expected = { "5:20: The warning 'unchecked' cannot be suppressed at this location.", "5:33: The warning 'unused' cannot be suppressed at this location.", @@ -288,26 +313,26 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "53:27: The warning '' cannot be suppressed at this location.", "56:28: The warning 'unchecked' cannot be suppressed at this location.", "59:49: The warning 'unchecked' cannot be suppressed at this location.", - + "64:34: The warning 'unchecked' cannot be suppressed at this location.", "64:48: The warning '' cannot be suppressed at this location.", "64:62: The warning 'unchecked' cannot be suppressed at this location.", "64:76: The warning '' cannot be suppressed at this location.", - + "67:38: The warning '' cannot be suppressed at this location.", "67:43: The warning 'unchecked' cannot be suppressed at this location.", - + "72:47: The warning ' ' cannot be suppressed at this location.", "72:55: The warning 'unused' cannot be suppressed at this location.", "72:66: The warning 'unchecked' cannot be suppressed at this location.", "72:98: The warning ' ' cannot be suppressed at this location.", "72:106: The warning 'unused' cannot be suppressed at this location.", "72:117: The warning 'unchecked' cannot be suppressed at this location.", - + "77:38: The warning 'unchecked' cannot be suppressed at this location.", "77:61: The warning ' ' cannot be suppressed at this location.", "77:69: The warning 'unused' cannot be suppressed at this location.", - + "82:48: The warning 'unchecked' cannot be suppressed at this location.", "82:94: The warning '' cannot be suppressed at this location.", "82:99: The warning 'foo' cannot be suppressed at this location.", @@ -328,10 +353,11 @@ public class SuppressWarningsTest extends BaseCheckTestSupport * @throws Exception */ @Test - public void testCompactNoUnchecked() throws Exception { + public void testCompactNoUnchecked() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*"); - + final String[] expected = { "5:20: The warning 'unchecked' cannot be suppressed at this location.", "11:28: The warning 'unchecked' cannot be suppressed at this location.", @@ -349,22 +375,23 @@ public class SuppressWarningsTest extends BaseCheckTestSupport }; verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsCompact.java"), expected); - + } - + /** * Tests SuppressWarnings unchecked warning disabled on certain tokens. * @throws Exception */ @Test - public void testCompactNoUncheckedTokens() throws Exception { + public void testCompactNoUncheckedTokens() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*"); checkConfig.addAttribute("tokens", "CLASS_DEF"); - + final String[] expected = { "5:20: The warning 'unchecked' cannot be suppressed at this location.", - + "64:34: The warning 'unchecked' cannot be suppressed at this location.", "64:62: The warning 'unchecked' cannot be suppressed at this location.", }; @@ -377,10 +404,11 @@ public class SuppressWarningsTest extends BaseCheckTestSupport * @throws Exception */ @Test - public void testCompactNoUnWildcard() throws Exception { + public void testCompactNoUnWildcard() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "un.*"); - + final String[] expected = { "5:20: The warning 'unchecked' cannot be suppressed at this location.", "5:33: The warning 'unused' cannot be suppressed at this location.", @@ -392,20 +420,20 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "47:28: The warning 'unused' cannot be suppressed at this location.", "56:28: The warning 'unchecked' cannot be suppressed at this location.", "59:49: The warning 'unchecked' cannot be suppressed at this location.", - + "64:34: The warning 'unchecked' cannot be suppressed at this location.", "64:62: The warning 'unchecked' cannot be suppressed at this location.", - + "67:43: The warning 'unchecked' cannot be suppressed at this location.", "72:55: The warning 'unused' cannot be suppressed at this location.", "72:66: The warning 'unchecked' cannot be suppressed at this location.", "72:106: The warning 'unused' cannot be suppressed at this location.", "72:117: The warning 'unchecked' cannot be suppressed at this location.", - + "77:38: The warning 'unchecked' cannot be suppressed at this location.", "77:69: The warning 'unused' cannot be suppressed at this location.", - + "82:48: The warning 'unchecked' cannot be suppressed at this location.", "82:115: The warning 'unused' cannot be suppressed at this location.", "82:135: The warning 'unchecked' cannot be suppressed at this location.", @@ -414,16 +442,17 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsCompact.java"), expected); } - + /** * Tests SuppressWarnings unchecked, unused warning disabled on everything. * @throws Exception */ @Test - public void testCompactNoUncheckedUnused() throws Exception { + public void testCompactNoUncheckedUnused() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*|^unused$"); - + final String[] expected = { "5:20: The warning 'unchecked' cannot be suppressed at this location.", "5:33: The warning 'unused' cannot be suppressed at this location.", @@ -433,7 +462,7 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "29:36: The warning 'unchecked' cannot be suppressed at this location.", "47:28: The warning 'unused' cannot be suppressed at this location.", "56:28: The warning 'unchecked' cannot be suppressed at this location.", - "59:49: The warning 'unchecked' cannot be suppressed at this location.", + "59:49: The warning 'unchecked' cannot be suppressed at this location.", "64:34: The warning 'unchecked' cannot be suppressed at this location.", "64:62: The warning 'unchecked' cannot be suppressed at this location.", "67:43: The warning 'unchecked' cannot be suppressed at this location.", @@ -447,20 +476,21 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "82:115: The warning 'unused' cannot be suppressed at this location.", "82:135: The warning 'unchecked' cannot be suppressed at this location.", "82:202: The warning 'unused' cannot be suppressed at this location.", - }; + }; verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsCompact.java"), expected); } - + /** * Tests SuppressWarnings *, unchecked, unused warning disabled on everything. * @throws Exception */ @Test - public void testCompactNoUncheckedUnusedAll() throws Exception { + public void testCompactNoUncheckedUnusedAll() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*|^unused$*|.*"); - + final String[] expected = { "5:20: The warning 'unchecked' cannot be suppressed at this location.", "5:33: The warning 'unused' cannot be suppressed at this location.", @@ -479,26 +509,26 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "53:27: The warning '' cannot be suppressed at this location.", "56:28: The warning 'unchecked' cannot be suppressed at this location.", "59:49: The warning 'unchecked' cannot be suppressed at this location.", - + "64:34: The warning 'unchecked' cannot be suppressed at this location.", "64:48: The warning '' cannot be suppressed at this location.", "64:62: The warning 'unchecked' cannot be suppressed at this location.", "64:76: The warning '' cannot be suppressed at this location.", - + "67:38: The warning '' cannot be suppressed at this location.", "67:43: The warning 'unchecked' cannot be suppressed at this location.", - + "72:47: The warning ' ' cannot be suppressed at this location.", "72:55: The warning 'unused' cannot be suppressed at this location.", "72:66: The warning 'unchecked' cannot be suppressed at this location.", "72:98: The warning ' ' cannot be suppressed at this location.", "72:106: The warning 'unused' cannot be suppressed at this location.", "72:117: The warning 'unchecked' cannot be suppressed at this location.", - + "77:38: The warning 'unchecked' cannot be suppressed at this location.", "77:61: The warning ' ' cannot be suppressed at this location.", "77:69: The warning 'unused' cannot be suppressed at this location.", - + "82:48: The warning 'unchecked' cannot be suppressed at this location.", "82:94: The warning '' cannot be suppressed at this location.", "82:99: The warning 'foo' cannot be suppressed at this location.", @@ -513,13 +543,14 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsCompact.java"), expected); } - + /** * Tests SuppressWarnings with default regex. * @throws Exception */ @Test - public void testExpandedDefault() throws Exception { + public void testExpandedDefault() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); final String[] expected = { @@ -541,16 +572,17 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsExpanded.java"), expected); } - + /** * Tests SuppressWarnings all warnings disabled on everything. * @throws Exception */ @Test - public void testExpandedAll() throws Exception { + public void testExpandedAll() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", ".*"); - + final String[] expected = { "5:26: The warning 'unchecked' cannot be suppressed at this location.", "5:39: The warning 'unused' cannot be suppressed at this location.", @@ -569,7 +601,7 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "53:33: The warning '' cannot be suppressed at this location.", "56:34: The warning 'unchecked' cannot be suppressed at this location.", "59:55: The warning 'unchecked' cannot be suppressed at this location.", - + "64:40: The warning 'unchecked' cannot be suppressed at this location.", "64:54: The warning '' cannot be suppressed at this location.", "64:68: The warning 'unchecked' cannot be suppressed at this location.", @@ -595,7 +627,7 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "82:192: The warning 'foo' cannot be suppressed at this location.", "82:200: The warning ' ' cannot be suppressed at this location.", "82:208: The warning 'unused' cannot be suppressed at this location.", - + }; verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsExpanded.java"), expected); @@ -606,17 +638,18 @@ public class SuppressWarningsTest extends BaseCheckTestSupport * @throws Exception */ @Test - public void testExpandedNoUnchecked() throws Exception { + public void testExpandedNoUnchecked() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*"); - + final String[] expected = { "5:26: The warning 'unchecked' cannot be suppressed at this location.", "11:34: The warning 'unchecked' cannot be suppressed at this location.", "29:42: The warning 'unchecked' cannot be suppressed at this location.", "56:34: The warning 'unchecked' cannot be suppressed at this location.", "59:55: The warning 'unchecked' cannot be suppressed at this location.", - + "64:40: The warning 'unchecked' cannot be suppressed at this location.", "64:68: The warning 'unchecked' cannot be suppressed at this location.", "67:49: The warning 'unchecked' cannot be suppressed at this location.", @@ -629,20 +662,21 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsExpanded.java"), expected); } - + /** * Tests SuppressWarnings unchecked warning disabled on certain tokens. * @throws Exception */ @Test - public void testExpandedNoUncheckedTokens() throws Exception { + public void testExpandedNoUncheckedTokens() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*"); checkConfig.addAttribute("tokens", "CLASS_DEF"); - + final String[] expected = { "5:26: The warning 'unchecked' cannot be suppressed at this location.", - + "64:40: The warning 'unchecked' cannot be suppressed at this location.", "64:68: The warning 'unchecked' cannot be suppressed at this location.", }; @@ -655,10 +689,11 @@ public class SuppressWarningsTest extends BaseCheckTestSupport * @throws Exception */ @Test - public void testExpandedNoUnWildcard() throws Exception { + public void testExpandedNoUnWildcard() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "un.*"); - + final String[] expected = { "5:26: The warning 'unchecked' cannot be suppressed at this location.", "5:39: The warning 'unused' cannot be suppressed at this location.", @@ -670,7 +705,7 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "47:34: The warning 'unused' cannot be suppressed at this location.", "56:34: The warning 'unchecked' cannot be suppressed at this location.", "59:55: The warning 'unchecked' cannot be suppressed at this location.", - + "64:40: The warning 'unchecked' cannot be suppressed at this location.", "64:68: The warning 'unchecked' cannot be suppressed at this location.", "67:49: The warning 'unchecked' cannot be suppressed at this location.", @@ -688,17 +723,18 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsExpanded.java"), expected); } - - + + /** * Tests SuppressWarnings unchecked, unused warning disabled on everything. * @throws Exception */ @Test - public void testExpandedNoUncheckedUnused() throws Exception { + public void testExpandedNoUncheckedUnused() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*|^unused$"); - + final String[] expected = { "5:26: The warning 'unchecked' cannot be suppressed at this location.", "5:39: The warning 'unused' cannot be suppressed at this location.", @@ -709,7 +745,7 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "47:34: The warning 'unused' cannot be suppressed at this location.", "56:34: The warning 'unchecked' cannot be suppressed at this location.", "59:55: The warning 'unchecked' cannot be suppressed at this location.", - + "64:40: The warning 'unchecked' cannot be suppressed at this location.", "64:68: The warning 'unchecked' cannot be suppressed at this location.", "67:49: The warning 'unchecked' cannot be suppressed at this location.", @@ -727,16 +763,17 @@ public class SuppressWarningsTest extends BaseCheckTestSupport verify(checkConfig, getPath("annotation" + File.separator + "SuppressWarningsExpanded.java"), expected); } - + /** * Tests SuppressWarnings *, unchecked, unused warning disabled on everything. * @throws Exception */ @Test - public void testExpandedNoUncheckedUnusedAll() throws Exception { + public void testExpandedNoUncheckedUnusedAll() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(SuppressWarningsCheck.class); checkConfig.addAttribute("format", "^unchecked$*|^unused$*|.*"); - + final String[] expected = { "5:26: The warning 'unchecked' cannot be suppressed at this location.", "5:39: The warning 'unused' cannot be suppressed at this location.", @@ -755,7 +792,7 @@ public class SuppressWarningsTest extends BaseCheckTestSupport "53:33: The warning '' cannot be suppressed at this location.", "56:34: The warning 'unchecked' cannot be suppressed at this location.", "59:55: The warning 'unchecked' cannot be suppressed at this location.", - + "64:40: The warning 'unchecked' cannot be suppressed at this location.", "64:54: The warning '' cannot be suppressed at this location.", "64:68: The warning 'unchecked' cannot be suppressed at this location.", diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheckTest.java index aeddbafe2..83d4757a2 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.blocks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java index b548b5692..492ac213a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.blocks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java index 366a87285..9dbcc1df4 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.blocks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -119,7 +137,7 @@ public class LeftCurlyCheckTest extends BaseCheckTestSupport }; verify(mCheckConfig, getPath("InputLeftCurlyOther.java"), expected); } - + @Test public void testNL3() throws Exception { @@ -146,27 +164,27 @@ public class LeftCurlyCheckTest extends BaseCheckTestSupport }; verify(mCheckConfig, getPath("InputBraces.java"), expected); } - + @Test public void testDefaultWithAnnotations() throws Exception { final String[] expected = { "10:1: '{' should be on the previous line.", "14:5: '{' should be on the previous line.", - "21:5: '{' should be on the previous line." + "21:5: '{' should be on the previous line.", }; verify(mCheckConfig, getPath("InputLeftCurlyAnnotations.java"), expected); } - + @Test public void testNLWithAnnotations() throws Exception { mCheckConfig.addAttribute("option", LeftCurlyOption.NL.toString()); - final String[] expected = { + final String[] expected = { "35:34: '{' should be on a new line.", "38:41: '{' should be on a new line.", "44:27: '{' should be on a new line.", - "58:32: '{' should be on a new line." + "58:32: '{' should be on a new line.", }; verify(mCheckConfig, getPath("InputLeftCurlyAnnotations.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckTest.java index 3ff831a10..37b9cff45 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckTest.java @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code for adherence to a set of rules. -// Copyright (C) 2001-2002 Oliver Burn +// Copyright (C) 2001-2010 Oliver Burn // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java index 9acdd5a20..ba8c591cb 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.blocks; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java index 1e7052d8b..aee921f7d 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java index 41becfb3c..e92f854c2 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheckTest.java index 409b1b085..b9161040c 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java index cf2b1a2a2..7f07c64a0 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java index c47140114..bc12c5f76 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -13,7 +31,7 @@ public class DefaultComesLastCheckTest extends BaseCheckTestSupport final DefaultConfiguration checkConfig = createCheckConfig(DefaultComesLastCheck.class); final String[] expected = { - "22:9: Default should be last label in the switch." + "22:9: Default should be last label in the switch.", }; verify(checkConfig, getPath("coding" + File.separator + "InputDefaultComesLast.java"), diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DoubleCheckedLockingCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DoubleCheckedLockingCheckTest.java index 75b27349d..45321182e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DoubleCheckedLockingCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/DoubleCheckedLockingCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckTest.java index b14e60d43..6033d0cea 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -15,22 +33,22 @@ public class EmptyStatementCheckTest final DefaultConfiguration checkConfig = createCheckConfig(EmptyStatementCheck.class); final String[] expected = { - "12:7: Empty statement.", - "17:7: Empty statement.", - "22:19: Empty statement.", - "26:10: Empty statement.", - "29:16: Empty statement.", - "33:10: Empty statement.", - "43:10: Empty statement.", - "49:13: Empty statement.", - "51:13: Empty statement.", - "54:19: Empty statement.", - "58:10: Empty statement.", - "61:9: Empty statement.", - "66:10: Empty statement.", - "72:10: Empty statement.", - "76:10: Empty statement.", - "80:10: Empty statement.", + "12:7: Empty statement.", + "17:7: Empty statement.", + "22:19: Empty statement.", + "26:10: Empty statement.", + "29:16: Empty statement.", + "33:10: Empty statement.", + "43:10: Empty statement.", + "49:13: Empty statement.", + "51:13: Empty statement.", + "54:19: Empty statement.", + "58:10: Empty statement.", + "61:9: Empty statement.", + "66:10: Empty statement.", + "72:10: Empty statement.", + "76:10: Empty statement.", + "80:10: Empty statement.", }; verify(checkConfig, getPath("InputEmptyStatement.java"), expected); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullTest.java index 55e7fd75f..55702c831 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -5,8 +23,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import java.io.File; import org.junit.Test; -public class EqualsAvoidNullTest -extends BaseCheckTestSupport +public class EqualsAvoidNullTest extends BaseCheckTestSupport { @Test public void testIt() throws Exception @@ -15,12 +32,12 @@ extends BaseCheckTestSupport createCheckConfig(EqualsAvoidNullCheck.class); final String[] expected = { - "18:17: String literal expressions should be on the left side of an equals comparison.", - "20:17: String literal expressions should be on the left side of an equals comparison.", - "22:17: String literal expressions should be on the left side of an equals comparison.", - "24:17: String literal expressions should be on the left side of an equals comparison.", - "26:17: String literal expressions should be on the left side of an equals comparison.", - "28:17: String literal expressions should be on the left side of an equals comparison.", + "18:17: String literal expressions should be on the left side of an equals comparison.", + "20:17: String literal expressions should be on the left side of an equals comparison.", + "22:17: String literal expressions should be on the left side of an equals comparison.", + "24:17: String literal expressions should be on the left side of an equals comparison.", + "26:17: String literal expressions should be on the left side of an equals comparison.", + "28:17: String literal expressions should be on the left side of an equals comparison.", }; verify(checkConfig, getPath("coding" + File.separator + "InputEqualsAvoidNull.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java index 3eaf5551e..295397822 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheckTest.java index 5ab67ac97..71aa607c3 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheckTest.java index 7b338fb20..cba17e547 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java index 9679f2e01..1b70c47c0 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheckTest.java index ed607109f..dabe11e0a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java index b6f8f4737..9383572fc 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java index d1f23081b..22ebde25c 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -22,11 +40,11 @@ public class IllegalInstantiationCheckTest "19:21: Instantiation of java.lang.Boolean should be avoided.", "24:21: Instantiation of java.lang.Boolean should be avoided.", "31:16: Instantiation of java.lang.Boolean should be avoided.", - "38:21: Instantiation of " + - "com.puppycrawl.tools.checkstyle.InputModifier " + - "should be avoided.", + "38:21: Instantiation of " + + "com.puppycrawl.tools.checkstyle.InputModifier " + + "should be avoided.", "41:18: Instantiation of java.io.File should be avoided.", - "44:21: Instantiation of java.awt.Color should be avoided." + "44:21: Instantiation of java.awt.Color should be avoided.", }; verify(checkConfig, getPath("InputSemantic.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java index 45c1da462..ff4ebb547 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheckTest.java index 246ceb011..1d7c5f672 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -22,17 +40,16 @@ public class IllegalTokenCheckTest } @Test - public void testNative() - throws Exception - { - final DefaultConfiguration checkConfig = - createCheckConfig(IllegalTokenCheck.class); - checkConfig.addAttribute("tokens", "LITERAL_NATIVE"); - final String[] expected = { - "20:12: Using 'native' is not allowed.", - }; - verify(checkConfig, getPath("InputIllegalTokens.java"), expected); - } + public void testNative() throws Exception + { + final DefaultConfiguration checkConfig = + createCheckConfig(IllegalTokenCheck.class); + checkConfig.addAttribute("tokens", "LITERAL_NATIVE"); + final String[] expected = { + "20:12: Using 'native' is not allowed.", + }; + verify(checkConfig, getPath("InputIllegalTokens.java"), expected); + } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckTest.java index 2a208126f..40b20fd73 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java index d6e60424d..8b8f9da7a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -11,12 +29,14 @@ public class IllegalTypeCheckTest extends BaseCheckTestSupport private DefaultConfiguration mCheckConfig; @Before - public void setUp() { + public void setUp() + { mCheckConfig = createCheckConfig(IllegalTypeCheck.class); } @Test - public void testDefaults() throws Exception { + public void testDefaults() throws Exception + { String[] expected = { "6:13: Declaring variables, return values or parameters of type 'AbstractClass' is not allowed.", "9:13: Declaring variables, return values or parameters of type " @@ -30,7 +50,8 @@ public class IllegalTypeCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreMethodNames() throws Exception { + public void testIgnoreMethodNames() throws Exception + { mCheckConfig.addAttribute("ignoredMethodNames", "table2"); String[] expected = { @@ -45,7 +66,8 @@ public class IllegalTypeCheckTest extends BaseCheckTestSupport } @Test - public void testFormat() throws Exception { + public void testFormat() throws Exception + { mCheckConfig.addAttribute("format", "^$"); String[] expected = { @@ -57,7 +79,8 @@ public class IllegalTypeCheckTest extends BaseCheckTestSupport } @Test - public void testLegalAbstractClassNames() throws Exception { + public void testLegalAbstractClassNames() throws Exception + { mCheckConfig.addAttribute("legalAbstractClassNames", "AbstractClass"); String[] expected = { diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckTest.java index de8357936..88f5ce83b 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheckTest.java index d3a7c40a4..b248f5243 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/JUnitTestCaseCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheckTest.java index 7afce356b..1ed4e026c 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -221,49 +239,49 @@ public class MagicNumberCheckTest } @Test - public void testIgnoreNegativeOctalHex() - throws Exception - { - final DefaultConfiguration checkConfig = - createCheckConfig(MagicNumberCheck.class); - checkConfig.addAttribute("ignoreNumbers", "-9223372036854775808, -2147483648, -1, 0, 1, 2"); - checkConfig.addAttribute("tokens", "NUM_INT, NUM_LONG"); - final String[] expected = { - "41:26: '3' is a magic number.", - "43:27: '3' is a magic number.", - "43:31: '4' is a magic number.", - "45:29: '3' is a magic number.", - "47:23: '3' is a magic number.", - "50:22: '3' is a magic number.", - "50:29: '5' is a magic number.", - "50:37: '3' is a magic number.", - "54:26: '3' is a magic number.", - "55:39: '3' is a magic number.", - "60:25: '010' is a magic number.", - "61:25: '011' is a magic number.", - "63:30: '010L' is a magic number.", - "64:30: '011l' is a magic number.", - "68:24: '0x10' is a magic number.", - "69:24: '0X011' is a magic number.", - "71:29: '0x10L' is a magic number.", - "72:29: '0X11l' is a magic number.", - "85:28: '3' is a magic number.", - "92:14: '0xffffffffL' is a magic number.", - "100:30: '+3' is a magic number.", - "101:29: '-2' is a magic number.", - "131:20: '378' is a magic number.", - "160:16: '31' is a magic number.", - "165:16: '42' is a magic number.", - "170:16: '13' is a magic number.", - "174:15: '21' is a magic number.", - "178:15: '37' is a magic number.", - "182:15: '101' is a magic number.", - }; - verify(checkConfig, getPath("InputMagicNumber.java"), expected); - } + public void testIgnoreNegativeOctalHex() throws Exception + { + final DefaultConfiguration checkConfig = + createCheckConfig(MagicNumberCheck.class); + checkConfig.addAttribute("ignoreNumbers", "-9223372036854775808, -2147483648, -1, 0, 1, 2"); + checkConfig.addAttribute("tokens", "NUM_INT, NUM_LONG"); + final String[] expected = { + "41:26: '3' is a magic number.", + "43:27: '3' is a magic number.", + "43:31: '4' is a magic number.", + "45:29: '3' is a magic number.", + "47:23: '3' is a magic number.", + "50:22: '3' is a magic number.", + "50:29: '5' is a magic number.", + "50:37: '3' is a magic number.", + "54:26: '3' is a magic number.", + "55:39: '3' is a magic number.", + "60:25: '010' is a magic number.", + "61:25: '011' is a magic number.", + "63:30: '010L' is a magic number.", + "64:30: '011l' is a magic number.", + "68:24: '0x10' is a magic number.", + "69:24: '0X011' is a magic number.", + "71:29: '0x10L' is a magic number.", + "72:29: '0X11l' is a magic number.", + "85:28: '3' is a magic number.", + "92:14: '0xffffffffL' is a magic number.", + "100:30: '+3' is a magic number.", + "101:29: '-2' is a magic number.", + "131:20: '378' is a magic number.", + "160:16: '31' is a magic number.", + "165:16: '42' is a magic number.", + "170:16: '13' is a magic number.", + "174:15: '21' is a magic number.", + "178:15: '37' is a magic number.", + "182:15: '101' is a magic number.", + }; + verify(checkConfig, getPath("InputMagicNumber.java"), expected); + } @Test - public void testIgnoreHashCodeMethod() throws Exception { + public void testIgnoreHashCodeMethod() throws Exception + { final DefaultConfiguration checkConfig = createCheckConfig(MagicNumberCheck.class); checkConfig.addAttribute("ignoreHashCodeMethod", "true"); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheckTest.java index 6710d12cb..91eb64a9e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheckTest.java index f50e5a19a..66d44e78e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheckTest.java index c152c687e..061fa99cc 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,7 +26,8 @@ public class ModifiedControlVariableCheckTest extends BaseCheckTestSupport { @Test - public void testModifiedControlVariable() throws Exception { + public void testModifiedControlVariable() throws Exception + { final DefaultConfiguration checkConfig = createCheckConfig(ModifiedControlVariableCheck.class); final String[] expected = { diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheckTest.java index ad742d4d4..570b94b96 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -19,7 +37,7 @@ public class MultipleStringLiteralsCheckTest extends BaseCheckTestSupport "5:16: The String \"StringContents\" appears 3 times in the file.", "8:17: The String \"\" appears 4 times in the file.", "10:23: The String \", \" appears 3 times in the file.", - }; + }; verify(checkConfig, getPath("coding" + File.separator + "InputMultipleStringLiterals.java"), diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheckTest.java index d6a68c82b..8e1f88c18 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java index cb18616ea..7708951bd 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheckTest.java @@ -1,6 +1,23 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; -import com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import org.junit.Test; @@ -9,7 +26,8 @@ import org.junit.Test; * The unit-test for the NestedForDepthCheck-checkstyle enhancement. * @see com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck */ -public class NestedForDepthCheckTest extends BaseCheckTestSupport { +public class NestedForDepthCheckTest extends BaseCheckTestSupport +{ /** * Call the check allowing 2 layers of nested for-statements. This * means the top-level for can contain up to 2 levels of nested for @@ -20,7 +38,8 @@ public class NestedForDepthCheckTest extends BaseCheckTestSupport { * interface-requirements for test-methods */ @Test - public void testNestedTooDeep() throws Exception { + public void testNestedTooDeep() throws Exception + { final DefaultConfiguration checkConfig = createCheckConfig(NestedForDepthCheck.class); checkConfig.addAttribute("max", "2"); @@ -45,7 +64,8 @@ public class NestedForDepthCheckTest extends BaseCheckTestSupport { * interface-requirements for test-methods */ @Test - public void testNestedOk() throws Exception { + public void testNestedOk() throws Exception + { final DefaultConfiguration checkConfig = createCheckConfig(NestedForDepthCheck.class); checkConfig.addAttribute("max", "4"); @@ -56,4 +76,4 @@ public class NestedForDepthCheckTest extends BaseCheckTestSupport { verify(checkConfig, getPath("coding/InputNestedForDepth.java"), expected); } -} \ No newline at end of file +} diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java index 343692dc8..ca3a5f6be 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheckTest.java index 942e248db..1250faff2 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheckTest.java index 6287122c3..41efacf0c 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheckTest.java @@ -1,10 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; - -import java.io.File; - import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import java.io.File; import org.junit.Test; /** diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheckTest.java index 7b992f373..95d4e60a1 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheckTest.java index c14d227c6..258c70f59 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheckTest.java @@ -1,20 +1,20 @@ //////////////////////////////////////////////////////////////////////////////// -//checkstyle: Checks Java source code for adherence to a set of rules. -//Copyright (C) 2001-2010 Oliver Burn +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn // -//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 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. +// 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 +// 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.puppycrawl.tools.checkstyle.checks.coding; @@ -22,16 +22,19 @@ import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import org.junit.Test; -public class OneStatementPerLineCheckTest extends BaseCheckTestSupport { +public class OneStatementPerLineCheckTest extends BaseCheckTestSupport +{ @Test - public void testMultiCaseClass() throws Exception { + public void testMultiCaseClass() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(OneStatementPerLineCheck.class); final String[] expected = { "99:18: Only one statement per line allowed.", - "127:11: Only one statement per line allowed.",}; + "127:11: Only one statement per line allowed.", + }; verify(checkConfig, getSrcPath("checks/coding/OneStatementPerLineCheckInput.java"), expected); } -} \ No newline at end of file +} diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheckTest.java index 1b1b83717..aa45cdd4b 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -27,7 +45,7 @@ public class PackageDeclarationCheckTest extends BaseCheckTestSupport .replace('/', File.separatorChar); String[] expected = { - "1:9: Package declaration does not match directory '" + dname + "'." + "1:9: Package declaration does not match directory '" + dname + "'.", }; verify(checkConfig, getPath("coding" + File.separator + "InputIllegalCatchCheck.java"), expected); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckTest.java index a83669069..5ce25649c 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RedundantThrowsCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RedundantThrowsCheckTest.java index 02645c02b..e3b30a5f6 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RedundantThrowsCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RedundantThrowsCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java index 7d87e3579..a4b63e0ac 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java index cf3bb5d47..960479915 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java @@ -1,9 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import java.io.File; import org.junit.Test; + public class ReturnCountCheckTest extends BaseCheckTestSupport { @Test diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheckTest.java index 045de3b50..896903c06 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,8 +26,7 @@ public class SimplifyBooleanExpressionCheckTest extends BaseCheckTestSupport { @Test - public void testIt() - throws Exception + public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(SimplifyBooleanExpressionCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheckTest.java index 00268c71a..0912e5438 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,8 +26,7 @@ public class SimplifyBooleanReturnCheckTest extends BaseCheckTestSupport { @Test - public void testIt() - throws Exception + public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(SimplifyBooleanReturnCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheckTest.java index 74ca3ef1f..874573e75 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -9,8 +27,7 @@ public class StringLiteralEqualityCheckTest extends BaseCheckTestSupport { @Test - public void testIt() - throws Exception + public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(StringLiteralEqualityCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheckTest.java index 67d475560..6338b63c6 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheckTest.java index 8a0cd9912..9916c2c94 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java index f06ce912e..a10b94184 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -12,8 +30,8 @@ import org.junit.Test; */ public class UnnecessaryParenthesesCheckTest extends BaseCheckTestSupport { - private static final String TEST_FILE = "coding" + File.separator + - "InputUnnecessaryParentheses.java"; + private static final String TEST_FILE = "coding" + File.separator + + "InputUnnecessaryParentheses.java"; @Test public void testDefault() throws Exception diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheckTest.java index e47a05e6b..c2d2fe373 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheckTest.java index 1c5867221..c326e2242 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java index cd996f55b..cd4a48051 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheckTest.java index 87ce405c1..0ae7104e7 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,22 +26,24 @@ import org.junit.Test; public class InnerTypeLastCheckTest extends BaseCheckTestSupport { @Test - public void testMembersBeforeInner() throws Exception { + public void testMembersBeforeInner() throws Exception + { final DefaultConfiguration checkConfig = createCheckConfig(InnerTypeLastCheck.class); final String[] expected = { - "15:17: Fields and methods should be before inner classes.", - "25:17: Fields and methods should be before inner classes.", - "26:17: Fields and methods should be before inner classes.", - "39:25: Fields and methods should be before inner classes.", - "40:25: Fields and methods should be before inner classes.", - "44:9: Fields and methods should be before inner classes.", - "60:25: Fields and methods should be before inner classes.", - "61:25: Fields and methods should be before inner classes.", - "65:9: Fields and methods should be before inner classes.", - "69:9: Fields and methods should be before inner classes.", - "78:5: Fields and methods should be before inner classes.", }; + "15:17: Fields and methods should be before inner classes.", + "25:17: Fields and methods should be before inner classes.", + "26:17: Fields and methods should be before inner classes.", + "39:25: Fields and methods should be before inner classes.", + "40:25: Fields and methods should be before inner classes.", + "44:9: Fields and methods should be before inner classes.", + "60:25: Fields and methods should be before inner classes.", + "61:25: Fields and methods should be before inner classes.", + "65:9: Fields and methods should be before inner classes.", + "69:9: Fields and methods should be before inner classes.", + "78:5: Fields and methods should be before inner classes.", + }; verify(checkConfig, getPath("design" + File.separator - + "InputInnerClassCheck.java"), expected); + + "InputInnerClassCheck.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckTest.java index bdbff69f2..f0ee6056a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java index 10f457fd7..b60faad9a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,7 +26,8 @@ import org.junit.Test; public class MutableExceptionCheckTest extends BaseCheckTestSupport { @Test - public void test() throws Exception { + public void test() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(MutableExceptionCheck.class); String[] expected = { diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheckTest.java index 83efce5bf..be0e74993 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,7 +26,8 @@ import org.junit.Test; public class ThrowsCountCheckTest extends BaseCheckTestSupport { @Test - public void testDefault() throws Exception { + public void testDefault() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(ThrowsCountCheck.class); String[] expected = { @@ -21,7 +40,8 @@ public class ThrowsCountCheckTest extends BaseCheckTestSupport } @Test - public void testMax() throws Exception { + public void testMax() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(ThrowsCountCheck.class); checkConfig.addAttribute("max", "2"); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheckTest.java index 998758ced..8d488f171 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -48,7 +66,8 @@ public class VisibilityModifierCheckTest } @Test - public void testSimple() throws Exception { + public void testSimple() throws Exception + { final String[] expected = { "39:19: Variable 'mNumCreated2' must be private and have accessor methods.", "49:23: Variable 'sTest1' must be private and have accessor methods.", @@ -61,8 +80,7 @@ public class VisibilityModifierCheckTest } @Test - public void testStrictJavadoc() - throws Exception + public void testStrictJavadoc() throws Exception { final String[] expected = { "44:9: Variable 'mLen' must be private and have accessor methods.", diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/duplicates/StrictDuplicateCodeCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/duplicates/StrictDuplicateCodeCheckTest.java index fec5e99e9..4ce57f0c3 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/duplicates/StrictDuplicateCodeCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/duplicates/StrictDuplicateCodeCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.duplicates; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -25,12 +43,12 @@ public class StrictDuplicateCodeCheckTest extends BaseCheckTestSupport final Configuration checkConfig = createCheckConfig(StrictDuplicateCodeCheck.class); final String innerDupPath = getPath("duplicates/InnerDup.java"); final String[] expected = { - "6: Found duplicate of 13 lines in " + innerDupPath + ", starting from line 22", - }; + "6: Found duplicate of 13 lines in " + innerDupPath + ", starting from line 22", + }; final File[] checkedFiles = new File[] { - new File(innerDupPath), - new File(getPath("duplicates/Shorty.java")), - }; + new File(innerDupPath), + new File(getPath("duplicates/Shorty.java")), + }; verify(createChecker(checkConfig), checkedFiles, innerDupPath, expected); } @@ -42,13 +60,13 @@ public class StrictDuplicateCodeCheckTest extends BaseCheckTestSupport final String aPath = getPath("duplicates/A.java"); final String bPath = getPath("duplicates/B.java"); final String[] expected = { - // imports should not be marked because developer cannot avoid them - // same constant def should not be marked because order is important for this check - }; + // imports should not be marked because developer cannot avoid them + // same constant def should not be marked because order is important for this check + }; final File[] checkedFiles = new File[] { - new File(aPath), - new File(bPath), - }; + new File(aPath), + new File(bPath), + }; verify(createChecker(checkConfig), checkedFiles, aPath, expected); } @@ -59,15 +77,15 @@ public class StrictDuplicateCodeCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("min", "3"); final String path = getPath("duplicates/Overlapping.java"); final String[] expected = { - "6: Found duplicate of 3 lines in " + path + ", starting from line 13", - "6: Found duplicate of 5 lines in " + path + ", starting from line 25", - "7: Found duplicate of 5 lines in " + path + ", starting from line 19", - "13: Found duplicate of 3 lines in " + path + ", starting from line 25", - "19: Found duplicate of 4 lines in " + path + ", starting from line 26", - }; + "6: Found duplicate of 3 lines in " + path + ", starting from line 13", + "6: Found duplicate of 5 lines in " + path + ", starting from line 25", + "7: Found duplicate of 5 lines in " + path + ", starting from line 19", + "13: Found duplicate of 3 lines in " + path + ", starting from line 25", + "19: Found duplicate of 4 lines in " + path + ", starting from line 26", + }; final File[] checkedFiles = new File[] { - new File(path), - }; + new File(path), + }; final Checker checker = createChecker(checkConfig); verify(checker, checkedFiles, path, expected); } @@ -78,10 +96,10 @@ public class StrictDuplicateCodeCheckTest extends BaseCheckTestSupport final DefaultConfiguration checkConfig = createCheckConfig(StrictDuplicateCodeCheck.class); final String path = getPath("duplicates/LotsOfEmptyLines.java"); final String[] expected = { - }; + }; final File[] checkedFiles = new File[] { - new File(path), - }; + new File(path), + }; final Checker checker = createChecker(checkConfig); verify(checker, checkedFiles, path, expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheckTest.java index b41a2d815..f35730757 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.header; import static org.junit.Assert.fail; @@ -10,15 +28,14 @@ import org.junit.Test; public class HeaderCheckTest extends BaseFileSetCheckTestSupport { @Test - public void testStaticHeader() - throws Exception + public void testStaticHeader() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("java.header")); checkConfig.addAttribute("ignoreLines", ""); final String[] expected = { - "1: Missing a header - not enough lines in file." + "1: Missing a header - not enough lines in file.", }; verify(checkConfig, getPath("inputHeader.java"), expected); } @@ -30,27 +47,25 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("headerFile", getPath("regexp.header")); final String[] expected = { - "3: Line does not match expected header line of '// Created: 2002'." + "3: Line does not match expected header line of '// Created: 2002'.", }; verify(checkConfig, getPath("InputScopeAnonInner.java"), expected); } @Test - public void testInlineRegexpHeader() - throws Exception + public void testInlineRegexpHeader() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); checkConfig.addAttribute("header", "^/*$\\n// .*\\n// Created: 2002\\n^//.*\\n^//.*"); final String[] expected = { - "3: Line does not match expected header line of '// Created: 2002'." + "3: Line does not match expected header line of '// Created: 2002'.", }; verify(checkConfig, getPath("InputScopeAnonInner.java"), expected); } @Test - public void testFailureForMultilineRegexp() - throws Exception + public void testFailureForMultilineRegexp() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RegexpHeaderCheck.class); @@ -131,7 +146,7 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport checkConfig.addAttribute("headerFile", getPath("regexp.header2")); checkConfig.addAttribute("multiLines", "3"); final String[] expected = { - "1: Missing a header - not enough lines in file." + "1: Missing a header - not enough lines in file.", }; verify(checkConfig, getPath("InputRegexpHeader4.java"), expected); } @@ -165,8 +180,7 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport } @Test - public void testNonExistingHeaderFile() - throws Exception + public void testNonExistingHeaderFile() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); @@ -181,8 +195,7 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport } @Test - public void testInvalidCharset() - throws Exception + public void testInvalidCharset() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); @@ -198,8 +211,7 @@ public class HeaderCheckTest extends BaseFileSetCheckTestSupport } @Test - public void testEmptyFilename() - throws Exception + public void testEmptyFilename() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HeaderCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AccessResultTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AccessResultTest.java index 6481fa733..ce1e60b23 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AccessResultTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AccessResultTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportTest.java index 63ddd8a35..65625c271 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -32,7 +50,7 @@ public class AvoidStarImportTest checkConfig.addAttribute("excludes", "java.io,java.lang"); // allow the java.io/java.lang star imports final String[] expected2 = new String[] { - "7: Using the '.*' form of import should be avoided - com.puppycrawl.tools.checkstyle.imports.*." + "7: Using the '.*' form of import should be avoided - com.puppycrawl.tools.checkstyle.imports.*.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected2); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportTest.java index 4bbb1a31a..e62a1a826 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -34,12 +52,12 @@ public class AvoidStaticImportTest checkConfig.addAttribute("excludes", "java.io.File.*,sun.net.ftpclient.FtpClient.*"); // allow the java.io.File.*/sun.net.ftpclient.FtpClient.* star imports final String[] expected = { - "25: Using a static member import should be avoided - javax.swing.WindowConstants.*.", - "26: Using a static member import should be avoided - javax.swing.WindowConstants.*.", - }; + "25: Using a static member import should be avoided - javax.swing.WindowConstants.*.", + "26: Using a static member import should be avoided - javax.swing.WindowConstants.*.", + }; verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected); } - + @Test public void testMemberExcludes() throws Exception @@ -49,29 +67,31 @@ public class AvoidStaticImportTest checkConfig.addAttribute("excludes", "java.io.File.listRoots"); // allow the java.io.File.listRoots member imports final String[] expected = { - "25: Using a static member import should be avoided - javax.swing.WindowConstants.*.", - "26: Using a static member import should be avoided - javax.swing.WindowConstants.*.", - "27: Using a static member import should be avoided - java.io.File.createTempFile.", - "28: Using a static member import should be avoided - sun.net.ftpclient.FtpClient.*.", - }; + "25: Using a static member import should be avoided - javax.swing.WindowConstants.*.", + "26: Using a static member import should be avoided - javax.swing.WindowConstants.*.", + "27: Using a static member import should be avoided - java.io.File.createTempFile.", + "28: Using a static member import should be avoided - sun.net.ftpclient.FtpClient.*.", + }; verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected); } - + @Test public void testBogusMemberExcludes() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(AvoidStaticImportCheck.class); - checkConfig.addAttribute("excludes", "java.io.File.listRoots.listRoots, javax.swing.WindowConstants," + - "sun.net.ftpclient.FtpClient.*FtpClient, sun.net.ftpclient.FtpClientjunk, java.io.File.listRootsmorejunk"); + checkConfig.addAttribute( + "excludes", + "java.io.File.listRoots.listRoots, javax.swing.WindowConstants," + + "sun.net.ftpclient.FtpClient.*FtpClient, sun.net.ftpclient.FtpClientjunk, java.io.File.listRootsmorejunk"); // allow the java.io.File.listRoots member imports final String[] expected = { - "23: Using a static member import should be avoided - java.io.File.listRoots.", - "25: Using a static member import should be avoided - javax.swing.WindowConstants.*.", - "26: Using a static member import should be avoided - javax.swing.WindowConstants.*.", - "27: Using a static member import should be avoided - java.io.File.createTempFile.", - "28: Using a static member import should be avoided - sun.net.ftpclient.FtpClient.*.", + "23: Using a static member import should be avoided - java.io.File.listRoots.", + "25: Using a static member import should be avoided - javax.swing.WindowConstants.*.", + "26: Using a static member import should be avoided - javax.swing.WindowConstants.*.", + "27: Using a static member import should be avoided - java.io.File.createTempFile.", + "28: Using a static member import should be avoided - sun.net.ftpclient.FtpClient.*.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/GuardTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/GuardTest.java index 6b0fc8fd5..851d39876 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/GuardTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/GuardTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheckTest.java index 12c363a0c..232f145ca 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -5,8 +23,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import java.io.File; import org.junit.Test; -public class IllegalImportCheckTest -extends BaseCheckTestSupport +public class IllegalImportCheckTest extends BaseCheckTestSupport { @Test public void testWithSupplied() diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckRegExTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckRegExTest.java index f9d994d3a..2fe36dbd3 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckRegExTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckRegExTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -25,9 +43,11 @@ public class ImportControlCheckRegExTest extends BaseCheckTestSupport final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class); checkConfig.addAttribute("file", System.getProperty("testinputs.dir") + "/import-control_two-re.xml"); - final String[] expected = {"3:1: Disallowed import - java.awt.Image.", - "4:1: Disallowed import - javax.swing.border.*.", - "6:1: Disallowed import - java.awt.Button.ABORT."}; + final String[] expected = { + "3:1: Disallowed import - java.awt.Image.", + "4:1: Disallowed import - javax.swing.border.*.", + "6:1: Disallowed import - java.awt.Button.ABORT.", + }; verify(checkConfig, getPath("imports" + File.separator + "InputImportControl.java"), expected); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java index 6c79ff198..433e03cb8 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import static org.junit.Assert.fail; @@ -27,9 +45,11 @@ public class ImportControlCheckTest extends BaseCheckTestSupport final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class); checkConfig.addAttribute("file", System.getProperty("testinputs.dir") + "/import-control_two.xml"); - final String[] expected = {"3:1: Disallowed import - java.awt.Image.", - "4:1: Disallowed import - javax.swing.border.*.", - "6:1: Disallowed import - java.awt.Button.ABORT."}; + final String[] expected = { + "3:1: Disallowed import - java.awt.Image.", + "4:1: Disallowed import - javax.swing.border.*.", + "6:1: Disallowed import - java.awt.Button.ABORT.", + }; verify(checkConfig, getPath("imports" + File.separator + "InputImportControl.java"), expected); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoaderTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoaderTest.java index b0d41cb54..82b0d7548 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoaderTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoaderTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import static org.junit.Assert.assertNotNull; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java index 74943f5d5..398512ab0 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -16,7 +34,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport "3: Wrong order for 'java.awt.Dialog' import.", "7: Wrong order for 'javax.swing.JComponent' import.", "9: Wrong order for 'java.io.File' import.", - "11: Wrong order for 'java.io.IOException' import." + "11: Wrong order for 'java.io.IOException' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder.java"), expected); @@ -30,7 +48,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport final String[] expected = { "3: Wrong order for 'java.awt.Dialog' import.", "11: Wrong order for 'java.io.IOException' import.", - "14: Wrong order for 'javax.swing.WindowConstants.*' import." + "14: Wrong order for 'javax.swing.WindowConstants.*' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder.java"), expected); @@ -59,7 +77,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport final String[] expected = { "7: 'javax.swing.JComponent' should be separated from previous imports.", "9: 'java.io.File' should be separated from previous imports.", - "14: Wrong order for 'javax.swing.WindowConstants.*' import." + "14: Wrong order for 'javax.swing.WindowConstants.*' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder.java"), expected); @@ -84,7 +102,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("option", "top"); final String[] expected = { "4: Wrong order for 'java.awt.Button.ABORT' import.", - "18: Wrong order for 'java.io.File.*' import." + "18: Wrong order for 'java.io.File.*' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_Top.java"), expected); @@ -100,7 +118,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport "5: Wrong order for 'java.awt.Button.ABORT' import.", "8: Wrong order for 'java.awt.Dialog' import.", "13: Wrong order for 'java.io.File' import.", - "14: Wrong order for 'java.io.File.createTempFile' import." + "14: Wrong order for 'java.io.File.createTempFile' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_Above.java"), expected); @@ -118,7 +136,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport "12: Wrong order for 'javax.swing.WindowConstants.*' import.", "13: Wrong order for 'javax.swing.JTable' import.", "15: Wrong order for 'java.io.File.createTempFile' import.", - "16: Wrong order for 'java.io.File' import." + "16: Wrong order for 'java.io.File' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_InFlow.java"), expected); @@ -134,7 +152,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport final String[] expected = { "5: Wrong order for 'java.awt.Dialog' import.", "11: Wrong order for 'java.awt.Button.ABORT' import.", - "14: Wrong order for 'java.io.File' import." + "14: Wrong order for 'java.io.File' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_Under.java"), expected); @@ -147,9 +165,9 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport createCheckConfig(ImportOrderCheck.class); checkConfig.addAttribute("option", "bottom"); final String[] expected = { - "15: Wrong order for 'java.io.File' import.", - "18: Wrong order for 'java.awt.Button.ABORT' import.", - "21: Wrong order for 'java.io.Reader' import." + "15: Wrong order for 'java.io.File' import.", + "18: Wrong order for 'java.awt.Button.ABORT' import.", + "21: Wrong order for 'java.io.Reader' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_Bottom.java"), expected); @@ -158,14 +176,14 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport @Test public void testHonorsTokenProperty() throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(ImportOrderCheck.class); + final DefaultConfiguration checkConfig = + createCheckConfig(ImportOrderCheck.class); checkConfig.addAttribute("tokens", "IMPORT"); final String[] expected = { "6: Wrong order for 'java.awt.Button' import.", }; - verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_HonorsTokensProperty.java"), expected); + verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_HonorsTokensProperty.java"), expected); } @Test @@ -174,7 +192,7 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport final DefaultConfiguration checkConfig = createCheckConfig(ImportOrderCheck.class); checkConfig.addAttribute("groups", "com,*,java"); final String[] expected = { - "9: Wrong order for 'javax.crypto.Cipher' import." + "9: Wrong order for 'javax.crypto.Cipher' import.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_Wildcard.java"), expected); @@ -198,10 +216,9 @@ public class ImportOrderCheckTest extends BaseCheckTestSupport @Test public void testNoFailureForRedundantImports() throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(ImportOrderCheck.class); - final String[] expected = {}; - verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_NoFailureForRedundantImports.java"), expected); + final DefaultConfiguration checkConfig = + createCheckConfig(ImportOrderCheck.class); + final String[] expected = {}; + verify(checkConfig, getPath("imports" + File.separator + "InputImportOrder_NoFailureForRedundantImports.java"), expected); } - } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/PkgControlRegExpTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/PkgControlRegExpTest.java index 95950f097..1fdcb448d 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/PkgControlRegExpTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/PkgControlRegExpTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/PkgControlTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/PkgControlTest.java index 09aa9a8a7..899d4f17a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/PkgControlTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/PkgControlTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheckTest.java index 7fe3b7904..d2db7071a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -20,7 +38,7 @@ public class RedundantImportCheckTest "10:1: Redundant import from the java.lang package - java.lang.*.", "11:1: Redundant import from the java.lang package - java.lang.String.", "14:1: Duplicate import to line 13 - java.util.List.", - "26:1: Duplicate import to line 25 - javax.swing.WindowConstants.*." + "26:1: Duplicate import to line 25 - javax.swing.WindowConstants.*.", }; verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java index bf86aeb15..ed79c08eb 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.imports; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -21,7 +39,8 @@ public class UnusedImportsCheckTest extends BaseCheckTestSupport "22:8: Unused import - javax.swing.BorderFactory.", "27:15: Unused import - java.io.File.createTempFile.", //"29:8: Unused import - java.awt.Component.", // Should be detected - "30:8: Unused import - java.awt.Label.",}; + "30:8: Unused import - java.awt.Label.", + }; verify(checkConfig, getPath("imports" + File.separator + "InputImport.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java index 8c2054156..50a5786bf 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.indentation; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -12,8 +30,7 @@ import org.junit.Test; public class IndentationCheckTest extends BaseCheckTestSupport { @Test - public void testInvalidLabel() - throws Exception + public void testInvalidLabel() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); final String[] expected = { @@ -31,8 +48,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport } @Test - public void testValidLabel() - throws Exception + public void testValidLabel() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); final String[] expected = { @@ -40,9 +56,8 @@ public class IndentationCheckTest extends BaseCheckTestSupport verify(checkConfig, getPath("indentation/InputValidLabelIndent.java"), expected); } - @Test - public void testValidIfWithChecker() - throws Exception + @Test + public void testValidIfWithChecker() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); final Checker c = createChecker(checkConfig); @@ -643,8 +658,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport } @Test - public void testTabs() - throws Exception + public void testTabs() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); checkConfig.addAttribute("basicOffset", Integer.valueOf(4).toString()); @@ -656,8 +670,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport } @Test - public void testIndentationLevel() - throws Exception + public void testIndentationLevel() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); checkConfig.addAttribute("basicOffset", Integer.valueOf(2).toString()); @@ -668,8 +681,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport } @Test - public void testCaseLevel() - throws Exception + public void testCaseLevel() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); checkConfig.addAttribute("caseIndent", Integer.valueOf(0).toString()); @@ -680,8 +692,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport } @Test - public void testBraceAdjustment() - throws Exception + public void testBraceAdjustment() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IndentationCheck.class); checkConfig.addAttribute("braceAdjustment", Integer.valueOf(2).toString()); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java index 76508b731..ca5b8bf65 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.javadoc; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -105,7 +123,8 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport "74:5: Missing a Javadoc comment.", "79:5: Missing a Javadoc comment.", "84:5: Missing a Javadoc comment.", - "94:32: Expected @param tag for 'aA'." }; + "94:32: Expected @param tag for 'aA'.", + }; verify(mCheckConfig, getPath("InputPublicOnly.java"), expected); } @@ -126,7 +145,8 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport "59:5: Missing a Javadoc comment.", "64:5: Missing a Javadoc comment.", "79:5: Missing a Javadoc comment.", - "84:5: Missing a Javadoc comment." }; + "84:5: Missing a Javadoc comment.", + }; verify(mCheckConfig, getPath("InputPublicOnly.java"), expected); } @@ -136,7 +156,8 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport mCheckConfig.addAttribute("scope", Scope.PUBLIC.getName()); final String[] expected = { "43:9: Missing a Javadoc comment.", - "44:9: Missing a Javadoc comment." }; + "44:9: Missing a Javadoc comment.", + }; verify(mCheckConfig, getPath("InputScopeInnerInterfaces.java"), expected); } @@ -429,13 +450,13 @@ public class JavadocMethodCheckTest extends BaseCheckTestSupport public void testInheritDoc() throws Exception { final String[] expected = { - "4:5: Invalid use of the {@inheritDoc} tag.", - "9:5: Invalid use of the {@inheritDoc} tag.", - "29:5: Invalid use of the {@inheritDoc} tag.", - "34:5: Invalid use of the {@inheritDoc} tag.", - "39:5: Invalid use of the {@inheritDoc} tag.", - "44:5: Invalid use of the {@inheritDoc} tag.", - }; + "4:5: Invalid use of the {@inheritDoc} tag.", + "9:5: Invalid use of the {@inheritDoc} tag.", + "29:5: Invalid use of the {@inheritDoc} tag.", + "34:5: Invalid use of the {@inheritDoc} tag.", + "39:5: Invalid use of the {@inheritDoc} tag.", + "44:5: Invalid use of the {@inheritDoc} tag.", + }; verify(mCheckConfig, getPath("javadoc/InputInheritDoc.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheckTest.java index 952fc90d2..45e167eb1 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.javadoc; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -19,8 +37,7 @@ public class JavadocPackageCheckTest } @Test - public void testMissing() - throws Exception + public void testMissing() throws Exception { final Configuration checkConfig = createCheckConfig(JavadocPackageCheck.class); final String[] expected = { @@ -36,7 +53,9 @@ public class JavadocPackageCheckTest public void testBoth() throws Exception { final Configuration checkConfig = createCheckConfig(JavadocPackageCheck.class); - final String[] expected = {"0: Legacy package.html file should be removed.",}; + final String[] expected = { + "0: Legacy package.html file should be removed.", + }; verify(createChecker(checkConfig), getPath("javadoc/bothfiles/Ignored.java"), getPath("javadoc/bothfiles/Ignored.java"), expected); @@ -46,7 +65,9 @@ public class JavadocPackageCheckTest public void testHtmlDisallowed() throws Exception { final Configuration checkConfig = createCheckConfig(JavadocPackageCheck.class); - final String[] expected = {"0: Missing package-info.java file.",}; + final String[] expected = { + "0: Missing package-info.java file.", + }; verify(createChecker(checkConfig), getPath("javadoc/pkghtml/Ignored.java"), getPath("javadoc/pkghtml/Ignored.java"), expected); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java index 62ebfabee..e2a7971e8 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.javadoc; import java.io.File; @@ -35,7 +53,7 @@ public class JavadocStyleCheckTest "186:8: Unclosed HTML tag found:
", "193: First sentence should end with a period.", "238: First sentence should end with a period.", - "335:33: Extra HTML tag found: " + "335:33: Extra HTML tag found: ", }; verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected); @@ -104,7 +122,7 @@ public class JavadocStyleCheckTest "90: Incomplete HTML tag found: * should fail <", "109:39: Extra HTML tag found: ", "186:8: Unclosed HTML tag found:
", - "335:33: Extra HTML tag found: " + "335:33: Extra HTML tag found: ", }; verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected); @@ -128,7 +146,7 @@ public class JavadocStyleCheckTest "205: Javadoc has empty description section.", "230: Javadoc has empty description section.", "238: First sentence should end with a period.", - "335:33: Extra HTML tag found: " + "335:33: Extra HTML tag found: ", }; verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected); @@ -155,7 +173,7 @@ public class JavadocStyleCheckTest "211: Javadoc has empty description section.", "230: Javadoc has empty description section.", "238: First sentence should end with a period.", - "335:33: Extra HTML tag found: " + "335:33: Extra HTML tag found: ", }; verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected); @@ -185,7 +203,7 @@ public class JavadocStyleCheckTest "218: Javadoc has empty description section.", "230: Javadoc has empty description section.", "238: First sentence should end with a period.", - "335:33: Extra HTML tag found: " + "335:33: Extra HTML tag found: ", }; verify(checkConfig, getPath("InputJavadocStyleCheck.java"), expected); @@ -245,13 +263,12 @@ public class JavadocStyleCheckTest "1: First sentence should end with a period.", }; - String basePath = "javadoc" + File.separator + - "pkginfo" + File.separator + - "invalidinherit" + File.separator; + String basePath = "javadoc" + File.separator + + "pkginfo" + File.separator + "invalidinherit" + File.separator; verify(createChecker(checkConfig), - getPath(basePath + "package-info.java"), - expected); + getPath(basePath + "package-info.java"), + expected); } @Test @@ -264,13 +281,12 @@ public class JavadocStyleCheckTest "1: First sentence should end with a period.", }; - String basePath = "javadoc" + File.separator + - "pkginfo" + File.separator + - "invalidformat" + File.separator; + String basePath = "javadoc" + File.separator + + "pkginfo" + File.separator + "invalidformat" + File.separator; verify(createChecker(checkConfig), - getPath(basePath + "package-info.java"), - expected); + getPath(basePath + "package-info.java"), + expected); } @Test @@ -282,13 +298,12 @@ public class JavadocStyleCheckTest { }; - String basePath = "javadoc" + File.separator + - "pkginfo" + File.separator + - "annotation" + File.separator; + String basePath = "javadoc" + File.separator + + "pkginfo" + File.separator + "annotation" + File.separator; verify(createChecker(checkConfig), - getPath(basePath + "package-info.java"), - expected); + getPath(basePath + "package-info.java"), + expected); } @Test @@ -296,17 +311,16 @@ public class JavadocStyleCheckTest { final DefaultConfiguration checkConfig = createCheckConfig(JavadocStyleCheck.class); - final String[] expected = - { - "1: Missing a Javadoc comment." + final String[] expected = { + "1: Missing a Javadoc comment.", }; - String basePath = "javadoc" + File.separator + - "bothfiles" + File.separator; + String basePath = "javadoc" + File.separator + + "bothfiles" + File.separator; verify(createChecker(checkConfig), - getPath(basePath + "package-info.java"), - expected); + getPath(basePath + "package-info.java"), + expected); } @Test @@ -316,12 +330,11 @@ public class JavadocStyleCheckTest createCheckConfig(JavadocStyleCheck.class); final String[] expected = {}; - String basePath = "javadoc" + File.separator + - "pkginfo" + File.separator + - "valid" + File.separator; + String basePath = "javadoc" + File.separator + + "pkginfo" + File.separator + "valid" + File.separator; verify(createChecker(checkConfig), - getPath(basePath + "package-info.java"), - expected); + getPath(basePath + "package-info.java"), + expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java index e39fccdbe..e62c9f504 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.javadoc; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -252,7 +270,7 @@ public class JavadocTypeCheckTest extends BaseCheckTestSupport "97: Missing a Javadoc comment.", }; verify(checkConfig, - getPath("javadoc" + File.separator +"InputNoJavadoc.java"), + getPath("javadoc" + File.separator + "InputNoJavadoc.java"), expected); } @@ -267,7 +285,7 @@ public class JavadocTypeCheckTest extends BaseCheckTestSupport "13: Missing a Javadoc comment.", }; verify(checkConfig, - getPath("javadoc" + File.separator +"InputNoJavadoc.java"), + getPath("javadoc" + File.separator + "InputNoJavadoc.java"), expected); } @@ -288,7 +306,7 @@ public class JavadocTypeCheckTest extends BaseCheckTestSupport "97: Missing a Javadoc comment.", }; verify(checkConfig, - getPath("javadoc" + File.separator +"InputNoJavadoc.java"), + getPath("javadoc" + File.separator + "InputNoJavadoc.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java index 8aed987fb..fb92bbda7 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.javadoc; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -124,7 +142,7 @@ public class JavadocVariableCheckTest "101:9: Missing a Javadoc comment.", }; verify(checkConfig, - getPath("javadoc" + File.separator +"InputNoJavadoc.java"), + getPath("javadoc" + File.separator + "InputNoJavadoc.java"), expected); } @@ -141,7 +159,7 @@ public class JavadocVariableCheckTest "15:9: Missing a Javadoc comment.", }; verify(checkConfig, - getPath("javadoc" + File.separator +"InputNoJavadoc.java"), + getPath("javadoc" + File.separator + "InputNoJavadoc.java"), expected); } @@ -187,7 +205,7 @@ public class JavadocVariableCheckTest "101:9: Missing a Javadoc comment.", }; verify(checkConfig, - getPath("javadoc" + File.separator +"InputNoJavadoc.java"), + getPath("javadoc" + File.separator + "InputNoJavadoc.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java index 7dd234430..2b205cd4c 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.javadoc; import static org.junit.Assert.assertEquals; @@ -23,7 +41,8 @@ public class WriteTagCheckTest extends BaseCheckTestSupport private DefaultConfiguration mCheckConfig; @Before - public void setUp() { + public void setUp() + { mCheckConfig = createCheckConfig(WriteTagCheck.class); } @@ -75,26 +94,24 @@ public class WriteTagCheckTest extends BaseCheckTestSupport @Test public void testDoubleTag() throws Exception { - mCheckConfig.addAttribute("tag", "@doubletag"); - mCheckConfig.addAttribute("tagFormat", "\\S"); - final String[] expected = - { - "12: @doubletag=first text", - "13: @doubletag=second text", - }; - verify(mCheckConfig, getPath("InputWriteTag.java"), expected); + mCheckConfig.addAttribute("tag", "@doubletag"); + mCheckConfig.addAttribute("tagFormat", "\\S"); + final String[] expected = { + "12: @doubletag=first text", + "13: @doubletag=second text", + }; + verify(mCheckConfig, getPath("InputWriteTag.java"), expected); } - + @Test public void testEmptyTag() throws Exception { - mCheckConfig.addAttribute("tag", "@emptytag"); - mCheckConfig.addAttribute("tagFormat", ""); - final String[] expected = - { - "14: @emptytag=", - }; - verify(mCheckConfig, getPath("InputWriteTag.java"), expected); + mCheckConfig.addAttribute("tag", "@emptytag"); + mCheckConfig.addAttribute("tagFormat", ""); + final String[] expected = { + "14: @emptytag=", + }; + verify(mCheckConfig, getPath("InputWriteTag.java"), expected); } @@ -117,9 +134,8 @@ public class WriteTagCheckTest extends BaseCheckTestSupport mCheckConfig.addAttribute("tokens", "INTERFACE_DEF, CLASS_DEF, METHOD_DEF, CTOR_DEF"); mCheckConfig.addAttribute("severity", "ignore"); - final String[] expected = - { - "19: @todo=Add a constructor comment", + final String[] expected = { + "19: @todo=Add a constructor comment", "30: @todo=Add a comment", }; verify(mCheckConfig, getPath("InputWriteTag.java"), expected); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheckTest.java index cb71b99e9..21d709786 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.metrics; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,20 +26,22 @@ import org.junit.Test; public class BooleanExpressionComplexityCheckTest extends BaseCheckTestSupport { @Test - public void test() throws Exception { + public void test() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(BooleanExpressionComplexityCheck.class); String[] expected = { - "13:9: Boolean expression complexity is 4 (max allowed is 3).", - "32:9: Boolean expression complexity is 6 (max allowed is 3).", + "13:9: Boolean expression complexity is 4 (max allowed is 3).", + "32:9: Boolean expression complexity is 6 (max allowed is 3).", }; verify(checkConfig, getPath("metrics" + File.separator + "BooleanExpressionComplexityCheckTestInput.java"), expected); } @Test - public void testNoBitwise() throws Exception { + public void testNoBitwise() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(BooleanExpressionComplexityCheck.class); checkConfig.addAttribute("max", "5"); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java index 7f83fda73..d17c55782 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.metrics; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,7 +26,8 @@ import org.junit.Test; public class ClassDataAbstractionCouplingCheckTest extends BaseCheckTestSupport { @Test - public void test() throws Exception { + public void test() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(ClassDataAbstractionCouplingCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java index 278cd2fd9..3f4f0f4a3 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.metrics; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,7 +26,8 @@ import org.junit.Test; public class ClassFanOutComplexityCheckTest extends BaseCheckTestSupport { @Test - public void test() throws Exception { + public void test() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(ClassFanOutComplexityCheck.class); checkConfig.addAttribute("max", "0"); @@ -19,11 +38,14 @@ public class ClassFanOutComplexityCheckTest extends BaseCheckTestSupport "27:1: Class Fan-Out Complexity is 4 (max allowed is 0).", }; - verify(checkConfig, getPath("metrics" + File.separator +"ClassCouplingCheckTestInput.java"), expected); + verify(checkConfig, + getPath("metrics" + File.separator + "ClassCouplingCheckTestInput.java"), + expected); } @Test - public void test15() throws Exception { + public void test15() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(ClassFanOutComplexityCheck.class); checkConfig.addAttribute("max", "0"); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheckTest.java index 5d2b73807..be412129d 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.metrics; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java index 723493600..e86ba74ef 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.metrics; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -14,7 +32,8 @@ public class JavaNCSSCheckTest extends BaseCheckTestSupport { @Test - public void test() throws Exception { + public void test() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(JavaNCSSCheck.class); checkConfig.addAttribute("methodMaximum", "0"); @@ -22,15 +41,16 @@ public class JavaNCSSCheckTest extends BaseCheckTestSupport checkConfig.addAttribute("fileMaximum", "2"); String[] expected = { - "2:1: NCSS for this file is 35 (max allowed is 2).", - "9:1: NCSS for this class is 22 (max allowed is 1).", - "14:5: NCSS for this method is 2 (max allowed is 0).", - "21:5: NCSS for this method is 4 (max allowed is 0).", - "30:5: NCSS for this method is 12 (max allowed is 0).", - "42:13: NCSS for this method is 2 (max allowed is 0).", - "49:5: NCSS for this class is 2 (max allowed is 1).", - "56:1: NCSS for this class is 10 (max allowed is 1).", - "61:5: NCSS for this method is 8 (max allowed is 0).",}; + "2:1: NCSS for this file is 35 (max allowed is 2).", + "9:1: NCSS for this class is 22 (max allowed is 1).", + "14:5: NCSS for this method is 2 (max allowed is 0).", + "21:5: NCSS for this method is 4 (max allowed is 0).", + "30:5: NCSS for this method is 12 (max allowed is 0).", + "42:13: NCSS for this method is 2 (max allowed is 0).", + "49:5: NCSS for this class is 2 (max allowed is 1).", + "56:1: NCSS for this class is 10 (max allowed is 1).", + "61:5: NCSS for this method is 8 (max allowed is 0).", + }; verify(checkConfig, getPath("metrics" + File.separator + "JavaNCSSCheckTestInput.java"), expected); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheckTest.java index 3313c54da..fddaad12d 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.metrics; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,7 +26,8 @@ import org.junit.Test; public class NPathComplexityCheckTest extends BaseCheckTestSupport { @Test - public void testCalculation() throws Exception { + public void testCalculation() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(NPathComplexityCheck.class); @@ -30,7 +49,8 @@ public class NPathComplexityCheckTest extends BaseCheckTestSupport } @Test - public void testIntegerOverflow() throws Exception { + public void testIntegerOverflow() throws Exception + { DefaultConfiguration checkConfig = createCheckConfig(NPathComplexityCheck.class); @@ -41,7 +61,7 @@ public class NPathComplexityCheckTest extends BaseCheckTestSupport final String expectedComplexity = NumberFormat.getInstance().format(largerThanMaxInt); String[] expected = { - "9:5: NPath Complexity is " + expectedComplexity + " (max allowed is 0)." + "9:5: NPath Complexity is " + expectedComplexity + " (max allowed is 0).", }; verify(checkConfig, getPath("ComplexityOverflow.java"), expected); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheckTest.java index c5ce25e5b..42c1589c8 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.modifier; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java index a51987337..0094fe32f 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.modifier; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,8 +26,7 @@ public class RedundantModifierTest extends BaseCheckTestSupport { @Test - public void testIt() - throws Exception + public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(RedundantModifierCheck.class); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheckTest.java index f95bb346e..dfda92bf6 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java index 29ac3ad18..be4e1c4db 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import static org.junit.Assert.fail; @@ -34,7 +52,7 @@ public class ConstantNameCheckTest createCheckConfig(ConstantNameCheck.class); final String[] expected = { "25:29: Name 'badConstant' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", - "142:30: Name 'BAD__NAME' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'." + "142:30: Name 'BAD__NAME' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", }; verify(checkConfig, getPath("InputSimple.java"), expected); } @@ -49,7 +67,7 @@ public class ConstantNameCheckTest checkConfig.addAttribute("applyToProtected", "false"); checkConfig.addAttribute("applyToPackage", "false"); final String[] expected = { - "142:30: Name 'BAD__NAME' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'." + "142:30: Name 'BAD__NAME' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", }; verify(checkConfig, getPath("InputSimple.java"), expected); } @@ -62,7 +80,7 @@ public class ConstantNameCheckTest createCheckConfig(ConstantNameCheck.class); final String[] expected = { "24:16: Name 'data' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", - "64:16: Name 'data' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'." + "64:16: Name 'data' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", }; verify(checkConfig, getPath("InputInner.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java index ab0d374f8..737b1c345 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java index 46a98ca1d..8452607b8 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheckTest.java index bfff0aeb4..f924e9ceb 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java index c2bd2a482..a238c02bd 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -22,75 +40,75 @@ public class MethodNameCheckTest @Test public void testMethodEqClass() throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(MethodNameCheck.class); + final DefaultConfiguration checkConfig = + createCheckConfig(MethodNameCheck.class); - final String[] expected = { - "12:16: Method Name 'InputMethNameEqualClsName' must not equal the enclosing class name.", - "12:16: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "17:17: Name 'PRIVATEInputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "23:20: Method Name 'Inner' must not equal the enclosing class name.", - "23:20: Name 'Inner' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "28:20: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "37:24: Method Name 'InputMethNameEqualClsName' must not equal the enclosing class name.", - "37:24: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "47:9: Method Name 'SweetInterface' must not equal the enclosing class name.", - "47:9: Name 'SweetInterface' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "53:17: Method Name 'Outter' must not equal the enclosing class name.", - "53:17: Name 'Outter' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - }; + final String[] expected = { + "12:16: Method Name 'InputMethNameEqualClsName' must not equal the enclosing class name.", + "12:16: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "17:17: Name 'PRIVATEInputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "23:20: Method Name 'Inner' must not equal the enclosing class name.", + "23:20: Name 'Inner' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "28:20: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "37:24: Method Name 'InputMethNameEqualClsName' must not equal the enclosing class name.", + "37:24: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "47:9: Method Name 'SweetInterface' must not equal the enclosing class name.", + "47:9: Name 'SweetInterface' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "53:17: Method Name 'Outter' must not equal the enclosing class name.", + "53:17: Name 'Outter' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + }; - verify(checkConfig, getPath("InputMethNameEqualClsName.java"), expected); + verify(checkConfig, getPath("InputMethNameEqualClsName.java"), expected); } @Test public void testMethodEqClassAllow() throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(MethodNameCheck.class); - checkConfig.addAttribute("allowClassName", "true"); //allow method names and class names to equal + final DefaultConfiguration checkConfig = + createCheckConfig(MethodNameCheck.class); + checkConfig.addAttribute("allowClassName", "true"); //allow method names and class names to equal - final String[] expected = { - "12:16: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "17:17: Name 'PRIVATEInputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "23:20: Name 'Inner' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "28:20: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "37:24: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "47:9: Name 'SweetInterface' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "53:17: Name 'Outter' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - }; + final String[] expected = { + "12:16: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "17:17: Name 'PRIVATEInputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "23:20: Name 'Inner' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "28:20: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "37:24: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "47:9: Name 'SweetInterface' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "53:17: Name 'Outter' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + }; - verify(checkConfig, getPath("InputMethNameEqualClsName.java"), expected); + verify(checkConfig, getPath("InputMethNameEqualClsName.java"), expected); } @Test public void testAccessTuning() throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(MethodNameCheck.class); - checkConfig.addAttribute("allowClassName", "true"); //allow method names and class names to equal - checkConfig.addAttribute("applyToPrivate", "false"); //allow method names and class names to equal - final String[] expected = { - "12:16: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "23:20: Name 'Inner' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "28:20: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "37:24: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "47:9: Name 'SweetInterface' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "53:17: Name 'Outter' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - }; + final DefaultConfiguration checkConfig = + createCheckConfig(MethodNameCheck.class); + checkConfig.addAttribute("allowClassName", "true"); //allow method names and class names to equal + checkConfig.addAttribute("applyToPrivate", "false"); //allow method names and class names to equal + final String[] expected = { + "12:16: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "23:20: Name 'Inner' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "28:20: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "37:24: Name 'InputMethNameEqualClsName' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "47:9: Name 'SweetInterface' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "53:17: Name 'Outter' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + }; - verify(checkConfig, getPath("InputMethNameEqualClsName.java"), expected); + verify(checkConfig, getPath("InputMethNameEqualClsName.java"), expected); } @Test public void testForNpe() throws Exception { - final DefaultConfiguration checkConfig = - createCheckConfig(MethodNameCheck.class); + final DefaultConfiguration checkConfig = + createCheckConfig(MethodNameCheck.class); - final String[] expected = { - }; + final String[] expected = { + }; - verify(checkConfig, getPath("naming/InputMethodNameExtra.java"), expected); + verify(checkConfig, getPath("naming/InputMethodNameExtra.java"), expected); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java index e381d78dc..b9e61848e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java index aa1d69c0b..6d970d284 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckTest.java index c0be00fda..7a100b64f 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java index 24d5ade5c..0682a61ec 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -26,7 +44,7 @@ public class TypeNameCheckTest final DefaultConfiguration checkConfig = createCheckConfig(TypeNameCheck.class); final String[] expected = { - "1:48: Name 'inputHeader' must match pattern '^[A-Z][a-zA-Z0-9]*$'." + "1:48: Name 'inputHeader' must match pattern '^[A-Z][a-zA-Z0-9]*$'.", }; verify(checkConfig, getPath("inputHeader.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/TypeParameterNameTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/TypeParameterNameTest.java index a9a1d4c36..352eb8bc0 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/TypeParameterNameTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/naming/TypeParameterNameTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.naming; import java.io.File; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java index c8c35b0e2..81aa2c14a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.regexp; import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; @@ -17,13 +35,12 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport } @Test - public void testIt() - throws Exception + public void testIt() throws Exception { final String illegal = "System\\.(out)|(err)\\.print(ln)?\\("; mCheckConfig.addAttribute("format", illegal); final String[] expected = { - "69: Line matches the illegal pattern '" + illegal + "'." + "69: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputSemantic.java"), expected); } @@ -43,21 +60,19 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport } @Test - public void testIgnoreCaseTrue() - throws Exception + public void testIgnoreCaseTrue() throws Exception { final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; mCheckConfig.addAttribute("format", illegal); mCheckConfig.addAttribute("ignoreCase", "true"); final String[] expected = { - "69: Line matches the illegal pattern '" + illegal + "'." + "69: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputSemantic.java"), expected); } @Test - public void testIgnoreCaseFalse() - throws Exception + public void testIgnoreCaseFalse() throws Exception { final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; mCheckConfig.addAttribute("format", illegal); @@ -67,23 +82,21 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport } @Test - public void testIllegalFailBelowErrorLimit() - throws Exception + public void testIllegalFailBelowErrorLimit() throws Exception { final String illegal = "^import"; mCheckConfig.addAttribute("format", illegal); final String[] expected = { "7: Line matches the illegal pattern '" + illegal + "'.", "8: Line matches the illegal pattern '" + illegal + "'.", - "9: Line matches the illegal pattern '" + illegal + "'." + "9: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputSemantic.java"), expected); } // Need to fix the line endings in the input file @Ignore @Test - public void testCarriageReturn() - throws Exception + public void testCarriageReturn() throws Exception { final String illegal = "\\r"; mCheckConfig.addAttribute("format", illegal); @@ -91,7 +104,7 @@ public class RegexpMultilineCheckTest extends BaseFileSetCheckTestSupport "14: Line matches the illegal pattern '" + illegal + "'.", "16: Line matches the illegal pattern '" + illegal + "'.", "19: Line matches the illegal pattern '" + illegal + "'.", - "21: Line matches the illegal pattern '" + illegal + "'." + "21: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputLineBreaks.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java index ed3d0a99f..9723fcbdb 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.regexp; import com.puppycrawl.tools.checkstyle.BaseFileSetCheckTestSupport; @@ -16,13 +34,12 @@ public class RegexpSinglelineCheckTest extends BaseFileSetCheckTestSupport } @Test - public void testIt() - throws Exception + public void testIt() throws Exception { final String illegal = "System\\.(out)|(err)\\.print(ln)?\\("; mCheckConfig.addAttribute("format", illegal); final String[] expected = { - "69: Line matches the illegal pattern '" + illegal + "'." + "69: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputSemantic.java"), expected); } @@ -42,21 +59,19 @@ public class RegexpSinglelineCheckTest extends BaseFileSetCheckTestSupport } @Test - public void testIgnoreCaseTrue() - throws Exception + public void testIgnoreCaseTrue() throws Exception { final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; mCheckConfig.addAttribute("format", illegal); mCheckConfig.addAttribute("ignoreCase", "true"); final String[] expected = { - "69: Line matches the illegal pattern '" + illegal + "'." + "69: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputSemantic.java"), expected); } @Test - public void testIgnoreCaseFalse() - throws Exception + public void testIgnoreCaseFalse() throws Exception { final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; mCheckConfig.addAttribute("format", illegal); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java index 9c2449be3..7cb559714 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.regexp; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -16,13 +34,12 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testIt() - throws Exception + public void testIt() throws Exception { final String illegal = "System\\.(out)|(err)\\.print(ln)?\\("; mCheckConfig.addAttribute("format", illegal); final String[] expected = { - "69: Line matches the illegal pattern '" + illegal + "'." + "69: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputSemantic.java"), expected); } @@ -42,21 +59,19 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCaseTrue() - throws Exception + public void testIgnoreCaseTrue() throws Exception { final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; mCheckConfig.addAttribute("format", illegal); mCheckConfig.addAttribute("ignoreCase", "true"); final String[] expected = { - "69: Line matches the illegal pattern '" + illegal + "'." + "69: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputSemantic.java"), expected); } @Test - public void testIgnoreCaseFalse() - throws Exception + public void testIgnoreCaseFalse() throws Exception { final String illegal = "SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("; mCheckConfig.addAttribute("format", illegal); @@ -66,8 +81,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsCppStyle() - throws Exception + public void testIgnoreCommentsCppStyle() throws Exception { // See if the comment is removed properly final String illegal = "don't use trailing comments"; @@ -79,22 +93,20 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsFalseCppStyle() - throws Exception + public void testIgnoreCommentsFalseCppStyle() throws Exception { // See if the comment is removed properly final String illegal = "don't use trailing comments"; mCheckConfig.addAttribute("format", illegal); mCheckConfig.addAttribute("ignoreComments", "false"); final String[] expected = { - "2: Line matches the illegal pattern '" + illegal + "'." + "2: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputTrailingComment.java"), expected); } @Test - public void testIgnoreCommentsCStyle() - throws Exception + public void testIgnoreCommentsCStyle() throws Exception { // See if the comment is removed properly final String illegal = "c-style 1"; @@ -106,21 +118,19 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsFalseCStyle() - throws Exception + public void testIgnoreCommentsFalseCStyle() throws Exception { final String illegal = "c-style 1"; mCheckConfig.addAttribute("format", illegal); mCheckConfig.addAttribute("ignoreComments", "false"); final String[] expected = { - "17: Line matches the illegal pattern '" + illegal + "'." + "17: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputTrailingComment.java"), expected); } @Test - public void testIgnoreCommentsMultipleCStyle() - throws Exception + public void testIgnoreCommentsMultipleCStyle() throws Exception { // See if a second comment on the same line is removed properly final String illegal = "c-style 2"; @@ -132,8 +142,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsMultiLine() - throws Exception + public void testIgnoreCommentsMultiLine() throws Exception { final String illegal = "Let's check multi-line comments"; mCheckConfig.addAttribute("format", illegal); @@ -144,8 +153,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsInlineStart() - throws Exception + public void testIgnoreCommentsInlineStart() throws Exception { final String illegal = "long ms /"; mCheckConfig.addAttribute("format", illegal); @@ -156,14 +164,13 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testIgnoreCommentsInlineEnd() - throws Exception + public void testIgnoreCommentsInlineEnd() throws Exception { final String illegal = "int z"; mCheckConfig.addAttribute("format", illegal); mCheckConfig.addAttribute("ignoreComments", "true"); final String[] expected = { - "20: Line matches the illegal pattern '" + illegal + "'." + "20: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputTrailingComment.java"), expected); } @@ -175,14 +182,13 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport mCheckConfig.addAttribute("format", illegal); mCheckConfig.addAttribute("ignoreComments", "true"); final String[] expected = { - "21: Line matches the illegal pattern '" + illegal + "'." + "21: Line matches the illegal pattern '" + illegal + "'.", }; verify(mCheckConfig, getPath("InputTrailingComment.java"), expected); } @Test - public void testIgnoreCommentsNoSpaces() - throws Exception + public void testIgnoreCommentsNoSpaces() throws Exception { // make sure the comment is not turned into spaces final String illegal = "long ms "; @@ -194,8 +200,7 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void test1371588() - throws Exception + public void test1371588() throws Exception { // StackOverflowError with trailing space and ignoreComments final String illegal = "\\s+$"; @@ -231,16 +236,14 @@ public class RegexpSinglelineJavaCheckTest extends BaseCheckTestSupport } @Test - public void testMissing() - throws Exception + public void testMissing() throws Exception { final String required = "This text is not in the file"; mCheckConfig.addAttribute("format", required); mCheckConfig.addAttribute("minimum", "1"); mCheckConfig.addAttribute("maximum", "1000"); final String[] expected = { - "0: File does not contain at least 1 matches for pattern '" - + required + "'." + "0: File does not contain at least 1 matches for pattern '" + required + "'.", }; verify(mCheckConfig, getPath("InputSemantic.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheckTest.java index 0c3d6c18c..ef2c71a4a 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheckTest.java @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code for adherence to a set of rules. -// Copyright (C) 2001-2002 Oliver Burn +// Copyright (C) 2001-2010 Oliver Burn // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java index 99d9164f8..db2a2a584 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.sizes; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckTest.java index 7ab69a3bd..eadea16fb 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.sizes; import static org.junit.Assert.fail; @@ -27,7 +45,7 @@ public class FileLengthCheckTest createCheckConfig(FileLengthCheck.class); checkConfig.addAttribute("max", "20"); final String[] expected = { - "1: File length is 225 lines (max allowed is 20)." + "1: File length is 225 lines (max allowed is 20).", }; verify(createChecker(checkConfig), getPath("InputSimple.java"), @@ -57,8 +75,7 @@ public class FileLengthCheckTest createChecker(checkConfig); fail("Should indicate illegal args"); } - catch (CheckstyleException ex) - { + catch (CheckstyleException ex) { // Expected Exception because of illegal argument for "max" } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheckTest.java index bab80d2cf..a74cfb272 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.sizes; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java index 983ddaaae..92ec025fc 100644 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java @@ -1,10 +1,29 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.sizes; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import org.junit.Test; -public class MethodCountCheckTest extends BaseCheckTestSupport { +public class MethodCountCheckTest extends BaseCheckTestSupport +{ @Test public void testDefaults() throws Exception @@ -62,4 +81,4 @@ public class MethodCountCheckTest extends BaseCheckTestSupport { verify(checkConfig, getSrcPath("checks/sizes/MethodCountCheckInput2.java"), expected); } -} \ No newline at end of file +} diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java index 080efac4b..084a588cc 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code for adherence to a set of rules. -// Copyright (C) 2001-2002 Oliver Burn +// Copyright (C) 2001-2010 Oliver Burn // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -31,7 +31,7 @@ public class MethodLengthCheckTest extends BaseCheckTestSupport createCheckConfig(MethodLengthCheck.class); checkConfig.addAttribute("max", "19"); final String[] expected = { - "79:5: Method length is 20 lines (max allowed is 19)." + "79:5: Method length is 20 lines (max allowed is 19).", }; verify(checkConfig, getPath("InputSimple.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java index 769221607..d06f74697 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code for adherence to a set of rules. -// Copyright (C) 2001-2002 Oliver Burn +// Copyright (C) 2001-2010 Oliver Burn // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -30,7 +30,7 @@ public class OuterTypeNumberCheckTest extends BaseCheckTestSupport final DefaultConfiguration checkConfig = createCheckConfig(OuterTypeNumberCheck.class); final String[] expected = { - "6:34: Outer types defined is 3 (max allowed is 1)." + "6:34: Outer types defined is 3 (max allowed is 1).", }; verify(checkConfig, getPath("InputSimple.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java index a787b6ea5..73b9620ed 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.sizes; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java index 6467d9999..187094a65 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java index f8c2ddaba..681b0e439 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java index a76f502d9..256b84cb1 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -44,7 +62,7 @@ public class FileTabCharacterCheckTest "155:10: Line contains a tab character.", "156:1: Line contains a tab character.", "157:3: Line contains a tab character.", - "158:3: Line contains a tab character." + "158:3: Line contains a tab character.", }; final File[] files = { new File(getPath("InputSimple.java")), @@ -59,7 +77,7 @@ public class FileTabCharacterCheckTest final DefaultConfiguration checkConfig = createConfig(false); final String path = getPath("Claira"); final String[] expected = { - "0: File not found!" + "0: File not found!", }; final File[] files = { new File(path), diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java index 93feab770..8abe0db78 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.google.common.collect.Maps; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java index d8b8e9d89..8e399a455 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java index 4b5f8ebbe..796b7acf3 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -43,7 +61,7 @@ public class NoWhitespaceAfterCheckTest final String[] expected = { "5:14: '.' is followed by whitespace.", "129:24: '.' is followed by whitespace.", - "136:12: '.' is followed by whitespace." + "136:12: '.' is followed by whitespace.", }; verify(checkConfig, getPath("InputWhitespace.java"), expected); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java index 1c2514054..35fbe335e 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -11,7 +29,8 @@ public class NoWhitespaceBeforeCheckTest private DefaultConfiguration checkConfig; @Before - public void setUp() { + public void setUp() + { checkConfig = createCheckConfig(NoWhitespaceBeforeCheck.class); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java index 0482250e1..7be238b91 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -11,7 +29,8 @@ public class OperatorWrapCheckTest private DefaultConfiguration checkConfig; @Before - public void setUp() { + public void setUp() + { checkConfig = createCheckConfig(OperatorWrapCheck.class); } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java index a8c66d4a3..c5129e5ad 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java index 7fb769148..18d721f3f 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java index 42e5a60a0..5167f7d2f 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundTest.java b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundTest.java index c73dda295..6a339663d 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.checks.whitespace; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; @@ -8,7 +26,7 @@ import org.junit.Test; public class WhitespaceAroundTest extends BaseCheckTestSupport { - DefaultConfiguration checkConfig; + private DefaultConfiguration checkConfig; @Before public void setUp() diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/CSVFilterTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/CSVFilterTest.java index 273ac969e..0411e31c6 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/CSVFilterTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/CSVFilterTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import static org.junit.Assert.assertFalse; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/FilterSetTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/FilterSetTest.java index 8eb1a3065..048fa1f09 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/FilterSetTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/FilterSetTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import static org.junit.Assert.assertFalse; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/IntMatchFilterTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/IntMatchFilterTest.java index dceefb762..6004a1534 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/IntMatchFilterTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/IntMatchFilterTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/IntRangeFilterTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/IntRangeFilterTest.java index 9ba1f4a0f..5056677d5 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/IntRangeFilterTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/IntRangeFilterTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/SeverityMatchFilterTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/SeverityMatchFilterTest.java index 68089ca3d..6e4069e83 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/SeverityMatchFilterTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/SeverityMatchFilterTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import static org.junit.Assert.assertFalse; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressElementTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressElementTest.java index aaf2dcb2a..c6d1a7c6b 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressElementTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressElementTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java index 17a53307a..acc440120 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java @@ -1,7 +1,21 @@ //////////////////////////////////////////////////////////////////////////////// -// Test case for checkstyle. +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import com.google.common.collect.Lists; @@ -23,23 +37,19 @@ import org.junit.Test; public class SuppressWithNearbyCommentFilterTest extends BaseCheckTestSupport { - static String[] sAllMessages = { + private static String[] sAllMessages = { "14:17: Name 'A1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "15:17: Name 'A2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "16:59: Name 'A3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "18:17: Name 'B1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "19:17: Name 'B2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "20:59: Name 'B3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "22:17: Name 'C1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "24:17: Name 'C2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "25:17: Name 'C3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "27:17: Name 'D1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "28:17: Name 'D2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "30:17: Name 'D3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "32:30: Name 'e1' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", "33:17: Name 'E2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "34:17: Name 'E3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", @@ -49,15 +59,13 @@ public class SuppressWithNearbyCommentFilterTest "38:17: Name 'E7' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "39:17: Name 'E8' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "40:30: Name 'e9' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", - "64:23: Catching 'Exception' is not allowed.", "66:23: Catching 'Throwable' is not allowed.", "73:11: Catching 'Exception' is not allowed.", }; @Test - public void testNone() - throws Exception + public void testNone() throws Exception { final DefaultConfiguration filterConfig = null; final String[] suppressed = { @@ -71,13 +79,12 @@ public class SuppressWithNearbyCommentFilterTest final DefaultConfiguration filterConfig = createFilterConfig(SuppressWithNearbyCommentFilter.class); final String[] suppressed = { - "14:17: Name 'A1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "15:17: Name 'A2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "16:59: Name 'A3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - - "18:17: Name 'B1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "19:17: Name 'B2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "20:59: Name 'B3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "14:17: Name 'A1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "15:17: Name 'A2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "16:59: Name 'A3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "18:17: Name 'B1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "19:17: Name 'B2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "20:59: Name 'B3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", }; verifySuppressed(filterConfig, suppressed); } @@ -89,8 +96,8 @@ public class SuppressWithNearbyCommentFilterTest createFilterConfig(SuppressWithNearbyCommentFilter.class); filterConfig.addAttribute("checkC", "false"); final String[] suppressed = { - "14:17: Name 'A1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "18:17: Name 'B1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "14:17: Name 'A1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "18:17: Name 'B1' must match pattern '^[a-z][a-zA-Z0-9]*$'.", }; verifySuppressed(filterConfig, suppressed); } @@ -102,11 +109,10 @@ public class SuppressWithNearbyCommentFilterTest createFilterConfig(SuppressWithNearbyCommentFilter.class); filterConfig.addAttribute("checkCPP", "false"); final String[] suppressed = { - "15:17: Name 'A2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "16:59: Name 'A3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - - "19:17: Name 'B2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "20:59: Name 'B3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "15:17: Name 'A2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "16:59: Name 'A3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "19:17: Name 'B2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "20:59: Name 'B3' must match pattern '^[a-z][a-zA-Z0-9]*$'.", }; verifySuppressed(filterConfig, suppressed); } @@ -121,8 +127,8 @@ public class SuppressWithNearbyCommentFilterTest filterConfig.addAttribute("messageFormat", "$1"); filterConfig.addAttribute("influenceFormat", "-1"); final String[] suppressed = { - "66:23: Catching 'Throwable' is not allowed.", - "73:11: Catching 'Exception' is not allowed.", + "66:23: Catching 'Throwable' is not allowed.", + "73:11: Catching 'Exception' is not allowed.", }; verifySuppressed(filterConfig, suppressed); } @@ -136,7 +142,7 @@ public class SuppressWithNearbyCommentFilterTest filterConfig.addAttribute("checkFormat", "$1"); filterConfig.addAttribute("influenceFormat", "1"); final String[] suppressed = { - "24:17: Name 'C2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "24:17: Name 'C2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", }; verifySuppressed(filterConfig, suppressed); } @@ -150,7 +156,7 @@ public class SuppressWithNearbyCommentFilterTest filterConfig.addAttribute("checkFormat", "$1"); filterConfig.addAttribute("influenceFormat", "-1"); final String[] suppressed = { - "28:17: Name 'D2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "28:17: Name 'D2' must match pattern '^[a-z][a-zA-Z0-9]*$'.", }; verifySuppressed(filterConfig, suppressed); } @@ -164,10 +170,10 @@ public class SuppressWithNearbyCommentFilterTest filterConfig.addAttribute("checkFormat", "$1"); filterConfig.addAttribute("influenceFormat", "$2"); final String[] suppressed = { - "35:30: Name 'e4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", - "36:17: Name 'E5' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "38:17: Name 'E7' must match pattern '^[a-z][a-zA-Z0-9]*$'.", - "39:17: Name 'E8' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "35:30: Name 'e4' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.", + "36:17: Name 'E5' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "38:17: Name 'E7' must match pattern '^[a-z][a-zA-Z0-9]*$'.", + "39:17: Name 'E8' must match pattern '^[a-z][a-zA-Z0-9]*$'.", }; verifySuppressed(filterConfig, suppressed); } @@ -180,7 +186,7 @@ public class SuppressWithNearbyCommentFilterTest protected void verifySuppressed(Configuration aFilterConfig, String[] aSuppressed) - throws Exception + throws Exception { verify(createChecker(aFilterConfig), getPath("filters/InputSuppressWithNearbyCommentFilter.java"), @@ -189,7 +195,7 @@ public class SuppressWithNearbyCommentFilterTest @Override protected Checker createChecker(Configuration aFilterConfig) - throws CheckstyleException + throws CheckstyleException { final DefaultConfiguration checkerConfig = new DefaultConfiguration("configuration"); @@ -214,9 +220,9 @@ public class SuppressWithNearbyCommentFilterTest private String[] removeSuppressed(String[] aFrom, String[] aRemove) { - final Collection coll = - Lists.newArrayList(Arrays.asList(aFrom)); - coll.removeAll(Arrays.asList(aRemove)); - return coll.toArray(new String[coll.size()]); + final Collection coll = + Lists.newArrayList(Arrays.asList(aFrom)); + coll.removeAll(Arrays.asList(aRemove)); + return coll.toArray(new String[coll.size()]); } } diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java index 63eedfffc..2abe72d55 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java @@ -1,7 +1,21 @@ //////////////////////////////////////////////////////////////////////////////// -// Test case for checkstyle. +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import com.google.common.collect.Lists; @@ -23,7 +37,7 @@ import org.junit.Test; public class SuppressionCommentFilterTest extends BaseCheckTestSupport { - static String[] sAllMessages = { + private static String[] sAllMessages = { "13:17: Name 'I' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "16:17: Name 'J' must match pattern '^[a-z][a-zA-Z0-9]*$'.", "19:17: Name 'K' must match pattern '^[a-z][a-zA-Z0-9]*$'.", @@ -41,8 +55,7 @@ public class SuppressionCommentFilterTest }; @Test - public void testNone() - throws Exception + public void testNone() throws Exception { final DefaultConfiguration filterConfig = null; final String[] suppressed = { @@ -126,8 +139,7 @@ public class SuppressionCommentFilterTest @Test - public void testExpansion() - throws Exception + public void testExpansion() throws Exception { final DefaultConfiguration filterConfig = createFilterConfig(SuppressionCommentFilter.class); @@ -143,8 +155,7 @@ public class SuppressionCommentFilterTest } @Test - public void testMessage() - throws Exception + public void testMessage() throws Exception { final DefaultConfiguration filterConfig = createFilterConfig(SuppressionCommentFilter.class); @@ -165,7 +176,7 @@ public class SuppressionCommentFilterTest protected void verifySuppressed(Configuration aFilterConfig, String[] aSuppressed) - throws Exception + throws Exception { verify(createChecker(aFilterConfig), getPath("filters/InputSuppressionCommentFilter.java"), @@ -174,7 +185,7 @@ public class SuppressionCommentFilterTest @Override protected Checker createChecker(Configuration aFilterConfig) - throws CheckstyleException + throws CheckstyleException { final DefaultConfiguration checkerConfig = new DefaultConfiguration("configuration"); diff --git a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java index df0897cda..805fed62f 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.filters; import static org.junit.Assert.assertEquals; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java b/src/tests/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java index dd79d2a7d..54650a471 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/grammars/EmbeddedNullCharTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.grammars; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java b/src/tests/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java index 168e1c7fe..40e3c5b73 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/grammars/HexFloatsTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.grammars; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/src/tests/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java b/src/tests/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java index 47f8a2910..cdeaee8f3 100755 --- a/src/tests/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java +++ b/src/tests/com/puppycrawl/tools/checkstyle/grammars/VarargTest.java @@ -1,3 +1,21 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2010 Oliver Burn +// +// 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.puppycrawl.tools.checkstyle.grammars; import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport; diff --git a/suppressions.xml b/suppressions.xml index 904f92151..8ebdc6803 100755 --- a/suppressions.xml +++ b/suppressions.xml @@ -26,6 +26,18 @@ + + + + + + + + + + + +