@@ -1085,6 +1085,7 @@ violations_drilldown.no_violations=No violations | |||
#------------------------------------------------------------------------------ | |||
resource_viewer.resource_deleted=This resource has been deleted. | |||
number_of_tests_covering_line=Number of tests covering this line : {0} | |||
#------------------------------------------------------------------------------ |
@@ -101,7 +101,8 @@ public class DefaultTestCase extends BeanVertex implements MutableTestCase { | |||
} | |||
public void covers(Testable testable, List<Integer> lines) { | |||
beanGraph().getUnderlyingGraph().addEdge(null, element(), ((BeanVertex) testable).element(), "covers").setProperty("lines", lines); | |||
BeanVertex testableVertex = ((BeanVertex) testable); | |||
beanGraph().getUnderlyingGraph().addEdge(null, element(), testableVertex.element(), "covers").setProperty("lines", lines); | |||
} | |||
public TestPlan testPlan() { |
@@ -54,6 +54,16 @@ public class DefaultTestable extends BeanVertex implements MutableTestable { | |||
return testCases; | |||
} | |||
public int countTestCasesOfLine(int line) { | |||
int number = 0; | |||
for (Edge edge : getCovers()) { | |||
if (Iterables.contains(testedLines(edge), Long.valueOf(line))) { | |||
number++; | |||
} | |||
} | |||
return number; | |||
} | |||
public Collection<TestCase> testCasesOfLine(int line) { | |||
ImmutableList.Builder<TestCase> cases = ImmutableList.builder(); | |||
for (Edge edge : getCovers()) { |
@@ -28,6 +28,8 @@ public interface Testable extends Perspective { | |||
Collection<TestCase> testCases(); | |||
int countTestCasesOfLine(int line); | |||
Collection<TestCase> testCasesOfLine(int line); | |||
SortedSet<Long> testedLines(); |
@@ -195,7 +195,8 @@ class ResourceController < ApplicationController | |||
@hits_by_line.each_pair do |line_id, hits| | |||
line = @lines[line_id-1] | |||
if line | |||
line.covered_lines = testable.testCasesOfLine(line_id).size if testable && testable.testCasesOfLine(line_id).size > 0 | |||
line.covered_lines = 0 | |||
line.covered_lines = testable.countTestCasesOfLine(line_id) if testable | |||
line.hits = hits.to_i | |||
line.conditions = @conditions_by_line[line_id].to_i | |||
line.covered_conditions = @covered_conditions_by_line[line_id].to_i |
@@ -99,7 +99,7 @@ | |||
<% if @display_coverage %> | |||
<% if line.highlighted? %> | |||
<td class="ind <%= hits_status -%>"><%= line.covered_lines if line.covered_lines -%></td> | |||
<td class="ind <%= hits_status -%>" title="<%= message("number_of_tests_covering_line", {:params => line.covered_lines.to_s}) if line.covered_lines > 0 -%>"><%= line.covered_lines if line.covered_lines > 0 -%></td> | |||
<td class="ind <%= conditions_status -%>"> | |||
<% if line.deprecated_conditions_label -%> | |||
<%= line.deprecated_conditions_label -%> |