use of org.sonarsource.sonarlint.core.analysis.container.analysis.filesystem.DefaultTextRange in project sonarlint-core by SonarSource.
the class DefaultLocationTests method verify_accessors.
@Test
void verify_accessors() {
var inputFile = mock(ClientInputFile.class);
var message = "fummy";
var sqApiTextRange = new DefaultTextRange(new DefaultTextPointer(1, 2), new DefaultTextPointer(3, 4));
var defaultLocation = new DefaultLocation(inputFile, sqApiTextRange, message);
assertThat(defaultLocation.getInputFile()).isSameAs(inputFile);
assertThat(defaultLocation.getMessage()).isSameAs(message);
assertThat(defaultLocation.getTextRange().getStartLine()).isEqualTo(1);
assertThat(defaultLocation.getTextRange().getStartLineOffset()).isEqualTo(2);
assertThat(defaultLocation.getTextRange().getEndLine()).isEqualTo(3);
assertThat(defaultLocation.getTextRange().getEndLineOffset()).isEqualTo(4);
}
use of org.sonarsource.sonarlint.core.analysis.container.analysis.filesystem.DefaultTextRange in project sonarlint-core by SonarSource.
the class DefaultFilterableIssueTests method delegate_textRange_to_rawIssue.
@Test
void delegate_textRange_to_rawIssue() {
TextRange textRange = new DefaultTextRange(new DefaultTextPointer(0, 1), new DefaultTextPointer(2, 3));
var activeRule = mock(ActiveRuleAdapter.class);
when(activeRule.ruleKey()).thenReturn(RuleKey.of("foo", "S123"));
var rawIssue = new Issue(activeRule, null, textRange, null, null, null);
FilterableIssue underTest = new DefaultFilterableIssue(rawIssue, mock(InputComponent.class));
assertThat(underTest.textRange()).usingRecursiveComparison().isEqualTo(textRange);
}
Aggregations