public NodePayload( CoverageData branchCoverage, CoverageData lineCoverage, double cyclomaticCodeComplexity, long hits) { metrics = new MetricRegistry(); IMetric.BasicMetricsEnum metric = IMetric.BasicMetricsEnum.hits; putMetric(new FixedValueMetric(metric.toString(), metric.desc(), hits)); metric = IMetric.BasicMetricsEnum.ccn; putMetric(new FixedValueMetric(metric.toString(), metric.desc(), cyclomaticCodeComplexity)); buildBranchMetrics(branchCoverage); buildLineMetrics(lineCoverage); }
private void buildLineMetrics(CoverageData line) { IMetric.BasicMetricsEnum metric = IMetric.BasicMetricsEnum.line_coverage_rate; putMetric(new FixedValueMetric(metric.toString(), metric.desc(), line.getCoverageRate())); metric = IMetric.BasicMetricsEnum.covered_lines; putMetric(new FixedValueMetric(metric.toString(), metric.desc(), line.getCovered())); metric = IMetric.BasicMetricsEnum.total_lines; putMetric(new FixedValueMetric(metric.toString(), metric.desc(), line.getTotal())); }
private void buildBranchMetrics(CoverageData branch) { IMetric.BasicMetricsEnum metric = IMetric.BasicMetricsEnum.branch_coverage_rate; putMetric(new FixedValueMetric(metric.toString(), metric.desc(), branch.getCoverageRate())); metric = IMetric.BasicMetricsEnum.covered_branches; putMetric(new FixedValueMetric(metric.toString(), metric.desc(), branch.getCovered())); metric = IMetric.BasicMetricsEnum.total_branches; putMetric(new FixedValueMetric(metric.toString(), metric.desc(), branch.getTotal())); }