pmd: update changelog, verify #1076

This commit is contained in:
Andreas Dangel 2013-03-24 20:33:54 +01:00
parent 4569842965
commit 26a862a51b
4 changed files with 43 additions and 0 deletions

View File

@ -17,6 +17,7 @@ Fixed bug 1064: Exception running PrematureDeclaration
Fixed bug 1068: CPD fails on broken symbolic links
Fixed bug 1073: Hard coded violation messages CommentSize
Fixed bug 1074: rule priority doesn't work on group definitions
Fixed bug 1076: Report.treeIterator() does not return all violations
Merged pull request #14: fix Nullpointer Exception when using -l jsp

View File

@ -1,3 +1,6 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.dfa.report;
import net.sourceforge.pmd.RuleViolation;

View File

@ -218,6 +218,33 @@ public class ReportTest extends RuleTst implements ReportListener {
assertTrue(summary.values().contains(Integer.valueOf(1)));
assertTrue(summary.values().contains(Integer.valueOf(2)));
}
@Test
public void testTreeIterator() {
Report r = new Report();
RuleContext ctx = new RuleContext();
Rule rule = new MockRule("name", "desc", "msg", "rulesetname");
JavaNode node1 = getNode(5, 5, ctx.getSourceCodeFilename(), true);
r.addRuleViolation(new JavaRuleViolation(rule, ctx, node1, rule.getMessage()));
JavaNode node2 = getNode(5, 6, ctx.getSourceCodeFilename(), true);
r.addRuleViolation(new JavaRuleViolation(rule, ctx, node2, rule.getMessage()));
Iterator<RuleViolation> violations = r.iterator();
int violationCount = 0;
while (violations.hasNext()) {
violations.next();
violationCount++;
}
assertEquals(2, violationCount);
Iterator<RuleViolation> treeIterator = r.treeIterator();
int treeCount = 0;
while (treeIterator.hasNext()) {
treeIterator.next();
treeCount++;
}
assertEquals(2, treeCount);
}
public static JavaNode getNode(int line, int column, String scopeName){
DummyJavaNode s = new DummyJavaNode(2);
@ -231,6 +258,15 @@ public class ReportTest extends RuleTst implements ReportListener {
return s;
}
public static JavaNode getNode(int line, int column, String scopeName, boolean nextLine) {
DummyJavaNode s = (DummyJavaNode)getNode(line, column, scopeName);
if (nextLine) {
s.testingOnly__setBeginLine(line + 1);
s.testingOnly__setBeginColumn(column + 4);
}
return s;
}
public static String render(Renderer renderer, Report report) throws IOException {
StringWriter writer = new StringWriter();
renderer.setWriter(writer);

View File

@ -1,3 +1,6 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.dfa.report;
import static org.junit.Assert.assertFalse;