diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/CloseResourceTest.java b/pmd/regress/test/net/sourceforge/pmd/rules/CloseResourceTest.java index d6506eb333..679ae1c3fb 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/CloseResourceTest.java +++ b/pmd/regress/test/net/sourceforge/pmd/rules/CloseResourceTest.java @@ -5,32 +5,16 @@ package test.net.sourceforge.pmd.rules; import net.sourceforge.pmd.Rule; import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; -import test.net.sourceforge.pmd.testframework.TestDescriptor; public class CloseResourceTest extends SimpleAggregatorTst { private Rule rule; - private TestDescriptor[] tests; public void setUp() { rule = findRule("design", "CloseResource"); - tests = extractTestsFromXml(rule); rule.addProperty("types", "Connection,Statement,ResultSet"); //Default } public void testAll() { - runTests(new TestDescriptor[] {tests[0], tests[1], tests[2], tests[3], tests[4]}); + runTests(rule); } - - public void testMultipleProperties(){ - runTest(tests[5]); - } - - public void testTypes(){ - runTest(tests[6]); - } - - public void testPropertySetter(){ - runTest(tests[7]); - } - } diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/EmptyCatchBlockRuleTest.java b/pmd/regress/test/net/sourceforge/pmd/rules/EmptyCatchBlockRuleTest.java index 6e0abbb282..39a828f5d0 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/EmptyCatchBlockRuleTest.java +++ b/pmd/regress/test/net/sourceforge/pmd/rules/EmptyCatchBlockRuleTest.java @@ -1,33 +1,19 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ +package test.net.sourceforge.pmd.rules; - /** - * BSD-style license; for more info see http://pmd.sourceforge.net/license.html - */ - package test.net.sourceforge.pmd.rules; - - import net.sourceforge.pmd.Rule; - import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; - import test.net.sourceforge.pmd.testframework.TestDescriptor; - - public class EmptyCatchBlockRuleTest extends SimpleAggregatorTst { - private Rule rule; - private TestDescriptor[] tests; - - public void setUp() { - rule = findRule("basic", "EmptyCatchBlock"); - tests = extractTestsFromXml(rule); - } - - public void testAll() { - runTests(tests); - } - - public void testCommentedBlocksAllowed() { - rule.addProperty("allowCommentedBlocks", "true"); - runTests(new TestDescriptor[]{ - new TestDescriptor(tests[7].getCode(), "single-line comment is OK", 0, rule), - new TestDescriptor(tests[8].getCode(), "multiple-line comment is OK", 0, rule), - new TestDescriptor(tests[9].getCode(), "Javadoc comment is OK", 0, rule), - }); - } - } - +import net.sourceforge.pmd.Rule; +import test.net.sourceforge.pmd.testframework.SimpleAggregatorTst; + +public class EmptyCatchBlockRuleTest extends SimpleAggregatorTst { + private Rule rule; + + public void setUp() { + rule = findRule("basic", "EmptyCatchBlock"); + } + + public void testAll() { + runTests(rule); + } +} diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/xml/CloseResource.xml b/pmd/regress/test/net/sourceforge/pmd/rules/xml/CloseResource.xml index bc3c08edf6..0d5f4bf274 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/xml/CloseResource.xml +++ b/pmd/regress/test/net/sourceforge/pmd/rules/xml/CloseResource.xml @@ -88,7 +88,7 @@ Bad, no closeTargets properties for statements 2 - + @@ -96,7 +96,7 @@ Ok, closeTargets properties for statements 0 - + @@ -115,7 +115,7 @@ readExternal(aStream); } ]]> - + diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/xml/EmptyCatchBlock.xml b/pmd/regress/test/net/sourceforge/pmd/rules/xml/EmptyCatchBlock.xml index 8cdaf2b289..4ff6b0d71c 100644 --- a/pmd/regress/test/net/sourceforge/pmd/rules/xml/EmptyCatchBlock.xml +++ b/pmd/regress/test/net/sourceforge/pmd/rules/xml/EmptyCatchBlock.xml @@ -103,48 +103,75 @@ public class Foo { } ]]> - - - - 1 - + - + ]]> 1 - + + + + true + 0 + + + - + ]]> 1 - + + + + true + 0 + + + + ]]> + + + 1 + - + + + true + 0 + + +