use of org.sonar.api.batch.sensor.symbol.NewSymbolTable in project sonarqube by SonarSource.
the class SensorContextTesterTest method duplicateSymbolReferences.
@Test(expected = UnsupportedOperationException.class)
public void duplicateSymbolReferences() {
NewSymbolTable symbolTable = tester.newSymbolTable().onFile(new TestInputFileBuilder("foo", "src/Foo.java").initMetadata("annot dsf fds foo bar").build());
symbolTable.newSymbol(1, 8, 1, 10);
symbolTable.save();
symbolTable = tester.newSymbolTable().onFile(new TestInputFileBuilder("foo", "src/Foo.java").initMetadata("annot dsf fds foo bar").build());
symbolTable.newSymbol(1, 8, 1, 10);
symbolTable.save();
}
use of org.sonar.api.batch.sensor.symbol.NewSymbolTable in project sonarqube by SonarSource.
the class SensorContextTesterTest method testSymbolReferences.
@Test
public void testSymbolReferences() {
assertThat(tester.referencesForSymbolAt("foo:src/Foo.java", 1, 0)).isNull();
NewSymbolTable symbolTable = tester.newSymbolTable().onFile(new TestInputFileBuilder("foo", "src/Foo.java").initMetadata("annot dsf fds foo bar").build());
symbolTable.newSymbol(1, 8, 1, 10);
symbolTable.newSymbol(1, 1, 1, 5).newReference(6, 9).newReference(1, 10, 1, 13);
symbolTable.save();
assertThat(tester.referencesForSymbolAt("foo:src/Foo.java", 1, 0)).isNull();
assertThat(tester.referencesForSymbolAt("foo:src/Foo.java", 1, 8)).isEmpty();
assertThat(tester.referencesForSymbolAt("foo:src/Foo.java", 1, 3)).extracting("start.line", "start.lineOffset", "end.line", "end.lineOffset").containsExactly(tuple(1, 6, 1, 9), tuple(1, 10, 1, 13));
}
Aggregations