diff options
author | Klaudio Sinani <klaudio.sinani@sonarsource.com> | 2022-08-10 13:37:31 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-10-26 20:03:10 +0000 |
commit | 84f0224faf4e45999e793f8d06b66c065dfc6399 (patch) | |
tree | beb055ee1d93aa0966ca01d8cbed088202ae59ef /sonar-scanner-engine/src/test/java/org/sonar/scanner/scan | |
parent | 30e6c8d94430d7087f14196032d77e3034262e83 (diff) | |
download | sonarqube-84f0224faf4e45999e793f8d06b66c065dfc6399.tar.gz sonarqube-84f0224faf4e45999e793f8d06b66c065dfc6399.zip |
SONAR-13579 Detect files moves in Pull Request scope
SONAR-13579 Get database files from target branch instead of snapshot
SONAR-13579 Store old relative file path to `FileAttributes` class
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner/scan')
-rw-r--r-- | sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java index 73c736b224b..94629f59b60 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/filesystem/StatusDetectionTest.java @@ -19,9 +19,11 @@ */ package org.sonar.scanner.scan.filesystem; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.junit.Test; import org.sonar.api.batch.fs.InputFile; @@ -31,6 +33,7 @@ import org.sonar.scanner.repository.FileData; import org.sonar.scanner.repository.ProjectRepositories; import org.sonar.scanner.repository.SingleProjectRepository; import org.sonar.scanner.scm.ScmChangedFiles; +import org.sonar.scm.git.ChangedFile; import static org.assertj.core.api.Assertions.assertThat; @@ -61,9 +64,10 @@ public class StatusDetectionTest { @Test public void detect_status_branches_confirm() { - ScmChangedFiles changedFiles = new ScmChangedFiles(Collections.singletonList(Paths.get("module", "src", "Foo.java"))); - StatusDetection statusDetection = new StatusDetection(projectRepositories, changedFiles); + Path filePath = Paths.get("module", "src", "Foo.java"); + ScmChangedFiles changedFiles = new ScmChangedFiles(List.of(new ChangedFile(filePath.toString(), filePath))); + StatusDetection statusDetection = new StatusDetection(projectRepositories, changedFiles); assertThat(statusDetection.status("foo", createFile("src/Foo.java"), "XXXXX")).isEqualTo(InputFile.Status.CHANGED); } |