aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/scanner
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2020-04-13 10:18:20 -0500
committersonartech <sonartech@sonarsource.com>2020-04-17 20:03:43 +0000
commit2ba726630087bb0baae61e05e1c20943ec9e6931 (patch)
tree73d132bc2aecc9f611b1e35d943d5b106aff0944 /sonar-scanner-engine/src/test/java/org/sonar/scanner
parente014a2b976e733f33f369b868dbdf475b06650fe (diff)
downloadsonarqube-2ba726630087bb0baae61e05e1c20943ec9e6931.tar.gz
sonarqube-2ba726630087bb0baae61e05e1c20943ec9e6931.zip
SONAR-13206 Show warning if scanner fails to detect files' encoding
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/mediumtest/branch/BranchMediumTest.java4
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java2
3 files changed, 6 insertions, 6 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java
index 5b82e07e82b..94497019efb 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/issue/ignore/scanner/IssueExclusionsRegexpScannerTest.java
@@ -35,7 +35,7 @@ import org.junit.Test;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.FileMetadata;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
-import org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer;
+import org.sonar.api.notifications.AnalysisWarnings;
import org.sonar.scanner.issue.ignore.scanner.IssueExclusionsLoader.DoubleRegexpMatcher;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -44,12 +44,10 @@ import static org.mockito.Mockito.mock;
public class IssueExclusionsRegexpScannerTest {
private DefaultInputFile javaFile;
- private IssueExclusionPatternInitializer patternsInitializer = mock(IssueExclusionPatternInitializer.class);
-
private List<Pattern> allFilePatterns;
private List<DoubleRegexpMatcher> blockPatterns;
private IssueExclusionsRegexpScanner regexpScanner;
- private FileMetadata fileMetadata = new FileMetadata();
+ private FileMetadata fileMetadata = new FileMetadata(mock(AnalysisWarnings.class));
@Before
public void init() {
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 3acfdb364c5..19668da6de3 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
@@ -32,6 +32,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.FileMetadata;
+import org.sonar.api.notifications.AnalysisWarnings;
import org.sonar.scanner.mediumtest.AnalysisResult;
import org.sonar.scanner.mediumtest.ScannerMediumTester;
import org.sonar.scanner.protocol.output.ScannerReport;
@@ -41,6 +42,7 @@ import org.sonar.xoo.XooPlugin;
import org.sonar.xoo.rule.XooRulesDefinition;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
public class BranchMediumTest {
@@ -68,7 +70,7 @@ public class BranchMediumTest {
Path xooUtCoverageFile = baseDir.toPath().resolve(FILE_PATH + ".coverage");
FileUtils.write(xooUtCoverageFile.toFile(), "1:2:2:1", StandardCharsets.UTF_8);
- String md5sum = new FileMetadata()
+ String md5sum = new FileMetadata(mock(AnalysisWarnings.class))
.readMetadata(Files.newInputStream(filepath), StandardCharsets.UTF_8, FILE_PATH)
.hash();
tester.addFileData(FILE_PATH, new FileData(md5sum, "1.1"));
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
index ba9349fbf15..13bbf1d1728 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/MetadataGeneratorTest.java
@@ -54,7 +54,7 @@ public class MetadataGeneratorTest {
@Before
public void setUp() {
- FileMetadata metadata = new FileMetadata();
+ FileMetadata metadata = new FileMetadata(mock(AnalysisWarnings.class));
IssueExclusionsLoader issueExclusionsLoader = new IssueExclusionsLoader(mock(IssueExclusionPatternInitializer.class), mock(IgnoreIssuesFilter.class),
mock(AnalysisWarnings.class));
generator = new MetadataGenerator(statusDetection, metadata, issueExclusionsLoader);