Search in sources :

Example 1 with ModuleCoverageAndDuplicationExclusions

use of org.sonar.scanner.scan.filesystem.ModuleCoverageAndDuplicationExclusions in project sonarqube by SonarSource.

the class ModuleCoverageAndDuplicationExclusionsTest method shouldNotExcludeFileBasedOnPattern.

@Test
public void shouldNotExcludeFileBasedOnPattern() {
    DefaultInputFile file = TestInputFileBuilder.create("foo", new File(baseDir, "moduleA"), new File(baseDir, "moduleA/src/org/polop/File.php")).setProjectBaseDir(baseDir.toPath()).build();
    coverageExclusions = new ModuleCoverageAndDuplicationExclusions(mockConfig("src/org/other/*", ""));
    assertThat(coverageExclusions.isExcludedForCoverage(file)).isFalse();
}
Also used : DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile) DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile) File(java.io.File) ModuleCoverageAndDuplicationExclusions(org.sonar.scanner.scan.filesystem.ModuleCoverageAndDuplicationExclusions) Test(org.junit.Test)

Example 2 with ModuleCoverageAndDuplicationExclusions

use of org.sonar.scanner.scan.filesystem.ModuleCoverageAndDuplicationExclusions in project sonarqube by SonarSource.

the class ModuleCoverageAndDuplicationExclusionsTest method shouldExcludeFileBasedOnPattern.

@Test
public void shouldExcludeFileBasedOnPattern() {
    DefaultInputFile file = TestInputFileBuilder.create("foo", new File(baseDir, "moduleA"), new File(baseDir, "moduleA/src/org/polop/File.php")).setProjectBaseDir(baseDir.toPath()).build();
    coverageExclusions = new ModuleCoverageAndDuplicationExclusions(mockConfig("src/org/polop/*", ""));
    assertThat(coverageExclusions.isExcludedForCoverage(file)).isTrue();
}
Also used : DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile) DefaultInputFile(org.sonar.api.batch.fs.internal.DefaultInputFile) File(java.io.File) ModuleCoverageAndDuplicationExclusions(org.sonar.scanner.scan.filesystem.ModuleCoverageAndDuplicationExclusions) Test(org.junit.Test)

Aggregations

File (java.io.File)2 Test (org.junit.Test)2 DefaultInputFile (org.sonar.api.batch.fs.internal.DefaultInputFile)2 ModuleCoverageAndDuplicationExclusions (org.sonar.scanner.scan.filesystem.ModuleCoverageAndDuplicationExclusions)2