use of org.sonar.api.test.Testable in project sonar-java by SonarSource.
the class UnitTestAnalyzer method addCoverage.
private boolean addCoverage(InputFile resource, InputFile testFile, String testName, List<Integer> coveredLines) {
boolean result = false;
Testable testAbleFile = perspectives.as(MutableTestable.class, resource);
if (testAbleFile != null) {
MutableTestPlan testPlan = perspectives.as(MutableTestPlan.class, testFile);
if (testPlan != null) {
for (MutableTestCase testCase : testPlan.testCasesByName(testName)) {
testCase.setCoverageBlock(testAbleFile, coveredLines);
result = true;
}
}
}
return result;
}
Aggregations