aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2017-01-11 17:49:34 +0100
committerDuarte Meneses <duarte.meneses@sonarsource.com>2017-01-27 16:26:30 +0100
commit7b3024ee784a83f274a8bcc76475cf2a91219283 (patch)
treecf3256f9164e5df584b41b244396c3d2f617cf7e /sonar-core
parent6840dc54995084e8410b5b6903353a94034cad34 (diff)
downloadsonarqube-7b3024ee784a83f274a8bcc76475cf2a91219283.tar.gz
sonarqube-7b3024ee784a83f274a8bcc76475cf2a91219283.zip
SONAR-8622 Lazily generate metadata for input files
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java b/sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java
index e9818a55d37..7e206f8053a 100644
--- a/sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/component/ComponentKeysTest.java
@@ -23,11 +23,12 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.batch.fs.InputFile;
-import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.resources.Directory;
import org.sonar.api.resources.Project;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class ComponentKeysTest {
@Rule
@@ -41,7 +42,8 @@ public class ComponentKeysTest {
Directory dir = Directory.create("src/org/foo");
assertThat(ComponentKeys.createEffectiveKey(project, dir)).isEqualTo("my_project:src/org/foo");
- InputFile file = new DefaultInputFile("foo", "foo/Bar.php");
+ InputFile file = mock(InputFile.class);
+ when(file.relativePath()).thenReturn("foo/Bar.php");
assertThat(ComponentKeys.createEffectiveKey("my_project", file)).isEqualTo("my_project:foo/Bar.php");
}