From 685f611b550e086b5a551bbbb9c79f103f203a9b Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 13 May 2015 18:01:43 +0200 Subject: SONAR-6548 Restore support of deprecated org.sonar.api.resources.InputFile --- .../java/org/sonar/api/batch/fs/internal/DefaultInputFileTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sonar-plugin-api/src/test') 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(); -- cgit v1.2.3