Search in sources :

Example 1 with ProjectCoverageAndDuplicationExclusions

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

the class ProjectCoverageExclusionsTest method shouldNotExcludeFileDuplicationBasedOnPattern.

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

Example 2 with ProjectCoverageAndDuplicationExclusions

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

the class ProjectCoverageExclusionsTest method shouldNotExcludeFileCoverageBasedOnPattern.

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

Example 3 with ProjectCoverageAndDuplicationExclusions

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

the class ProjectCoverageExclusionsTest method shouldExcludeFileCoverageBasedOnPattern.

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

Example 4 with ProjectCoverageAndDuplicationExclusions

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

the class ProjectCoverageExclusionsTest method shouldExcludeFileDuplicationBasedOnPattern.

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

Aggregations

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