aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-xoo-plugin/src/test
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-02-20 11:09:49 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2015-02-20 15:05:18 +0100
commit38357bb24905509dd775e40bdf09e40aec6af39c (patch)
treee7043ad143fdf642764b6244dedba4336ee1af09 /plugins/sonar-xoo-plugin/src/test
parent54beb6267d98d4e7429480bfbfaa70c8d1f73eff (diff)
downloadsonarqube-38357bb24905509dd775e40bdf09e40aec6af39c.tar.gz
sonarqube-38357bb24905509dd775e40bdf09e40aec6af39c.zip
SONAR-5931 Cleanup symbol reference API
Diffstat (limited to 'plugins/sonar-xoo-plugin/src/test')
-rw-r--r--plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java
index 5673221a46e..332629c8469 100644
--- a/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java
+++ b/plugins/sonar-xoo-plugin/src/test/java/org/sonar/xoo/lang/SymbolReferencesSensorTest.java
@@ -28,8 +28,9 @@ import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
-import org.sonar.api.batch.sensor.symbol.Symbol;
-import org.sonar.api.batch.sensor.symbol.SymbolTableBuilder;
+import org.sonar.api.component.ResourcePerspectives;
+import org.sonar.api.source.Symbol;
+import org.sonar.api.source.Symbolizable;
import java.io.File;
import java.io.IOException;
@@ -47,11 +48,13 @@ public class SymbolReferencesSensorTest {
@Rule
public TemporaryFolder temp = new TemporaryFolder();
private File baseDir;
+ private ResourcePerspectives perspectives;
@Before
public void prepare() throws IOException {
baseDir = temp.newFolder();
- sensor = new SymbolReferencesSensor();
+ perspectives = mock(ResourcePerspectives.class);
+ sensor = new SymbolReferencesSensor(perspectives);
fileSystem = new DefaultFileSystem(baseDir.toPath());
when(context.fileSystem()).thenReturn(fileSystem);
}
@@ -74,8 +77,10 @@ public class SymbolReferencesSensorTest {
FileUtils.write(symbol, "1,4,7\n12,15,23\n\n#comment");
DefaultInputFile inputFile = new DefaultInputFile("foo", "src/foo.xoo").setLanguage("xoo");
fileSystem.add(inputFile);
- SymbolTableBuilder symbolTableBuilder = mock(SymbolTableBuilder.class);
- when(context.symbolTableBuilder(inputFile)).thenReturn(symbolTableBuilder);
+ Symbolizable symbolizable = mock(Symbolizable.class);
+ when(perspectives.as(Symbolizable.class, inputFile)).thenReturn(symbolizable);
+ Symbolizable.SymbolTableBuilder symbolTableBuilder = mock(Symbolizable.SymbolTableBuilder.class);
+ when(symbolizable.newSymbolTableBuilder()).thenReturn(symbolTableBuilder);
Symbol symbol1 = mock(Symbol.class);
when(symbolTableBuilder.newSymbol(1, 4)).thenReturn(symbol1);