Search in sources :

Example 1 with StatisticalRule

use of net.sourceforge.pmd.lang.rule.stat.StatisticalRule in project pmd by pmd.

the class StatisticalRuleTest method testSingleDatapoint.

// Test Single Datapoint
@Test
public void testSingleDatapoint() {
    StatisticalRule rule = new MockStatisticalRule();
    DataPoint point = new DataPoint();
    point.setScore(POINTS + 1.0);
    DummyNode s = new DummyNode(1);
    s.testingOnlySetBeginLine(POINTS + 1);
    s.testingOnlySetBeginColumn(1);
    point.setNode(s);
    point.setMessage("SingleDataPoint");
    rule.setProperty(MINIMUM_DESCRIPTOR, (double) POINTS);
    rule.addDataPoint(point);
    Report report = makeReport(rule);
    assertEquals("Expecting only one result", 1, report.size());
}
Also used : StatisticalRule(net.sourceforge.pmd.lang.rule.stat.StatisticalRule) Report(net.sourceforge.pmd.Report) DummyNode(net.sourceforge.pmd.lang.ast.DummyNode) Test(org.junit.Test)

Aggregations

Report (net.sourceforge.pmd.Report)1 DummyNode (net.sourceforge.pmd.lang.ast.DummyNode)1 StatisticalRule (net.sourceforge.pmd.lang.rule.stat.StatisticalRule)1 Test (org.junit.Test)1