Search in sources :

Example 1 with CoverageAlreadyExistsException

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;
}
Also used : DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile) CoverageAlreadyExistsException(org.sonar.api.test.exception.CoverageAlreadyExistsException)

Aggregations

DefaultInputFile (org.sonar.api.batch.fs.internal.DefaultInputFile)1 CoverageAlreadyExistsException (org.sonar.api.test.exception.CoverageAlreadyExistsException)1