aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-08-02 11:06:20 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2017-08-04 14:58:16 +0200
commitbcae3c079bef995afef0ffc4dbe774fbdf0bf9ed (patch)
treedcdb45969ce79cdc88827152796dba4fb7ae7355 /sonar-scanner-engine/src/test/java/org
parent69d96f792448e9809bed04ecc1ea0dd520e8f9e6 (diff)
downloadsonarqube-bcae3c079bef995afef0ffc4dbe774fbdf0bf9ed.tar.gz
sonarqube-bcae3c079bef995afef0ffc4dbe774fbdf0bf9ed.zip
Fix quality flaws
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/CoverageExclusionsTest.java6
5 files changed, 12 insertions, 12 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java
index 5c0c0351fc2..8761acc1e5c 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java
@@ -125,10 +125,10 @@ public class BranchMediumTest {
.execute();
assertThat(result.inputFiles()).hasSize(1);
- assertThat(result.inputFile("src/sample.xoo").key()).isEqualTo("com.foo.project:moduleA:src/sample.xoo");
+ assertThat(result.inputFile("moduleA/src/sample.xoo").key()).isEqualTo("com.foo.project:moduleA:src/sample.xoo");
// no branch in the report
- DefaultInputFile inputfile = (DefaultInputFile) result.inputFile("src/sample.xoo");
+ DefaultInputFile inputfile = (DefaultInputFile) result.inputFile("moduleA/src/sample.xoo");
assertThat(result.getReportReader().readComponent(inputfile.batchId()).getPath()).isEqualTo("src/sample.xoo");
// no branch in InputModule's key or in report
@@ -145,7 +145,7 @@ public class BranchMediumTest {
.execute();
assertThat(result.inputFiles()).hasSize(1);
- assertThat(result.inputFile("src/sample.xoo").key()).isEqualTo("com.foo.project:moduleA:src/sample.xoo");
+ assertThat(result.inputFile("moduleA/src/sample.xoo").key()).isEqualTo("com.foo.project:moduleA:src/sample.xoo");
}
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java
index c42972232d4..e780fe99ad6 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/coverage/CoverageMediumTest.java
@@ -232,7 +232,7 @@ public class CoverageMediumTest {
.build())
.execute();
- InputFile file1 = result.inputFile("src/sample1.xoo");
+ InputFile file1 = result.inputFile("module1/src/sample1.xoo");
assertThat(result.coverageFor(file1, 1)).isNull();
assertThat(result.coverageFor(file1, 2).getHits()).isFalse();
@@ -242,7 +242,7 @@ public class CoverageMediumTest {
assertThat(result.coverageFor(file1, 3).getHits()).isFalse();
assertThat(result.coverageFor(file1, 4)).isNull();
- InputFile file2 = result.inputFile("src/sample2.xoo");
+ InputFile file2 = result.inputFile("module1/src/sample2.xoo");
assertThat(result.coverageFor(file2, 1)).isNull();
assertThat(result.coverageFor(file2, 2)).isNull();
assertThat(result.coverageFor(file2, 3)).isNull();
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java
index 00c1ca1042a..ed41c72973d 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/cpd/CpdMediumTest.java
@@ -142,8 +142,8 @@ public class CpdMediumTest {
assertThat(result.inputFiles()).hasSize(2);
- InputFile inputFile1 = result.inputFile("sample1.xoo");
- InputFile inputFile2 = result.inputFile("sample2.xoo");
+ InputFile inputFile1 = result.inputFile("module1/sample1.xoo");
+ InputFile inputFile2 = result.inputFile("module2/sample2.xoo");
// One clone group on each file
List<org.sonar.scanner.protocol.output.ScannerReport.Duplication> duplicationGroupsFile1 = result.duplicationsFor(inputFile1);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
index bf86ea126c1..61fb4627b6d 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/fs/ProjectBuilderMediumTest.java
@@ -132,7 +132,7 @@ public class ProjectBuilderMediumTest {
.put("sonar.xoo.enableProjectBuilder", "true")
.build())
.execute();
- List<Issue> issues = result.issuesFor(result.inputFile("src/sample.xoo"));
+ List<Issue> issues = result.issuesFor(result.inputFile("module1/src/sample.xoo"));
assertThat(issues).hasSize(10);
assertThat(issues)
@@ -181,7 +181,7 @@ public class ProjectBuilderMediumTest {
.build())
.execute();
- List<Issue> issues = result.issuesFor(result.inputFile("src/sample.xoo"));
+ List<Issue> issues = result.issuesFor(result.inputFile("module1/src/sample.xoo"));
assertThat(issues).hasSize(10);
assertThat(issues)
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/CoverageExclusionsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/CoverageExclusionsTest.java
index a6d208b35bb..ec448a90233 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/CoverageExclusionsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/phases/CoverageExclusionsTest.java
@@ -21,7 +21,7 @@ package org.sonar.scanner.phases;
import org.junit.Before;
import org.junit.Test;
-import org.sonar.api.batch.fs.InputFile;
+import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.config.internal.MapSettings;
@@ -41,7 +41,7 @@ public class CoverageExclusionsTest {
@Test
public void shouldExcludeFileBasedOnPattern() {
- InputFile file = new TestInputFileBuilder("foo", "src/org/polop/File.php").build();
+ DefaultInputFile file = new TestInputFileBuilder("foo", "src/org/polop/File.php").build();
settings.setProperty("sonar.coverage.exclusions", "src/org/polop/*");
coverageExclusions = new CoverageExclusions(settings.asConfig());
assertThat(coverageExclusions.isExcluded(file)).isTrue();
@@ -49,7 +49,7 @@ public class CoverageExclusionsTest {
@Test
public void shouldNotExcludeFileBasedOnPattern() {
- InputFile file = new TestInputFileBuilder("foo", "src/org/polop/File.php").build();
+ DefaultInputFile file = new TestInputFileBuilder("foo", "src/org/polop/File.php").build();
settings.setProperty("sonar.coverage.exclusions", "src/org/other/*");
coverageExclusions = new CoverageExclusions(settings.asConfig());
assertThat(coverageExclusions.isExcluded(file)).isFalse();