junit assert failures should not be converted into errors

AssertionError was caught by Throwable and rethrown as RuntimeException


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5575 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2007-10-24 18:19:19 +00:00
parent 5ba3fbbf6c
commit ee020670b6

View File

@ -72,17 +72,20 @@ public abstract class RuleTst {
Properties ruleProperties = rule.getProperties();
Properties oldProperties = (Properties)ruleProperties.clone();
try {
if (test.getProperties() != null) {
oldProperties = (Properties)ruleProperties.clone();
ruleProperties.putAll(test.getProperties());
int res;
try {
if (test.getProperties() != null) {
oldProperties = (Properties)ruleProperties.clone();
ruleProperties.putAll(test.getProperties());
}
res = processUsingStringReader(test.getCode(), rule, test.getSourceType()).size();
} catch (Throwable t) {
t.printStackTrace();
throw new RuntimeException("Test \"" + test.getDescription() + "\" on Rule \"" + test.getRule().getName() + "\"failed");
}
int res = processUsingStringReader(test.getCode(), rule, test.getSourceType()).size();
assertEquals("\"" + test.getDescription() + "\" test resulted in wrong number of failures,",
test.getNumberOfProblemsExpected(), res);
} catch (Throwable t) {
t.printStackTrace();
throw new RuntimeException("Test \"" + test.getDescription() + "\" on Rule \"" + test.getRule().getName() + "\"failed");
test.getNumberOfProblemsExpected(), res);
} finally {
//Restore old properties
ruleProperties.clear();