aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-05-13 18:01:43 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-05-13 18:08:23 +0200
commit685f611b550e086b5a551bbbb9c79f103f203a9b (patch)
treef52978d23c007d02cdca318739e13efd46e622d7 /sonar-plugin-api/src/test
parentaaf1d2f100350ea95e6dfaa34bd001075d2e2584 (diff)
downloadsonarqube-685f611b550e086b5a551bbbb9c79f103f203a9b.tar.gz
sonarqube-685f611b550e086b5a551bbbb9c79f103f203a9b.zip
SONAR-6548 Restore support of deprecated org.sonar.api.resources.InputFile
Diffstat (limited to 'sonar-plugin-api/src/test')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultInputFileTest.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultInputFileTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultInputFileTest.java
index 3e3339bf63d..596662d861a 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultInputFileTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/fs/internal/DefaultInputFileTest.java
@@ -25,6 +25,7 @@ import org.junit.rules.TemporaryFolder;
import org.sonar.api.batch.fs.InputFile;
import java.io.File;
+import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
@@ -36,14 +37,17 @@ public class DefaultInputFileTest {
@Test
public void test() throws Exception {
+ Path baseDir = temp.newFolder().toPath();
DefaultInputFile inputFile = new DefaultInputFile("ABCDE", "src/Foo.php")
- .setModuleBaseDir(temp.newFolder().toPath())
+ .setModuleBaseDir(baseDir)
.setLines(42)
.setLanguage("php")
.setStatus(InputFile.Status.ADDED)
.setType(InputFile.Type.TEST);
assertThat(inputFile.relativePath()).isEqualTo("src/Foo.php");
+ assertThat(inputFile.getRelativePath()).isEqualTo("src/Foo.php");
+ assertThat(inputFile.getFile()).isEqualTo(new File(baseDir.toFile(), "src/Foo.php"));
assertThat(new File(inputFile.relativePath())).isRelative();
assertThat(inputFile.absolutePath()).endsWith("Foo.php");
assertThat(new File(inputFile.absolutePath())).isAbsolute();