use of org.sonar.api.test.exception.CoverageAlreadyExistsException in project sonarqube by SonarSource.
the class DefaultTestCase method setCoverageBlock.
@Override
public MutableTestCase setCoverageBlock(InputFile mainFile, List<Integer> lines) {
Preconditions.checkArgument(mainFile.type() == Type.MAIN, "Test file can only cover a main file");
DefaultInputFile coveredFile = (DefaultInputFile) mainFile;
if (coverageBlocksByTestedFile.containsKey(coveredFile)) {
throw new CoverageAlreadyExistsException("The link between " + name() + " and " + coveredFile.key() + " already exists");
}
coverageBlocksByTestedFile.put(coveredFile, new DefaultCoverageBlock(this, coveredFile, lines));
return this;
}
Aggregations