use of org.sonar.scanner.source.DefaultHighlightable in project sonarqube by SonarSource.
the class DefaultHighlightableTest method should_store_highlighting_rules.
@Test
public void should_store_highlighting_rules() {
SensorStorage sensorStorage = mock(SensorStorage.class);
DefaultInputFile inputFile = new TestInputFileBuilder("foo", "src/Foo.php").initMetadata("azerty\nbla bla").build();
DefaultHighlightable highlightablePerspective = new DefaultHighlightable(inputFile, sensorStorage, mock(AnalysisMode.class));
highlightablePerspective.newHighlighting().highlight(0, 6, "k").highlight(7, 10, "cppd").done();
ArgumentCaptor<DefaultHighlighting> argCaptor = ArgumentCaptor.forClass(DefaultHighlighting.class);
verify(sensorStorage).store(argCaptor.capture());
assertThat(argCaptor.getValue().getSyntaxHighlightingRuleSet()).hasSize(2);
}
Aggregations