public TextRange newRange(int startLine, int startLineOffset, int endLine, int endLineOffset) {
TextPointer start = newPointer(startLine, startLineOffset);
TextPointer end = newPointer(endLine, endLineOffset);
- Preconditions.checkArgument(start.compareTo(end) < 0, "Start pointer %s should be before end pointer %s", start, end);
return newRangeValidPointers(start, end);
}
* Create Range from global offsets. Used for backward compatibility with older API.
*/
public TextRange newRange(int startOffset, int endOffset) {
- Preconditions.checkArgument(startOffset < endOffset, "Start offset %s should be strictly before end offset %s", startOffset, endOffset);
return newRangeValidPointers(newPointer(startOffset), newPointer(endOffset));
}
checkInputFileNotNull();
TextRange newRange;
try {
+ // TODO remove when SONAR-7664 is implemented
+ Preconditions.checkArgument(startOffset < endOffset, "start offset should be strictly before end offset");
newRange = inputFile.newRange(startOffset, endOffset);
} catch (Exception e) {
throw new IllegalArgumentException("Unable to highlight file " + inputFile, e);
.save();
}
- @Test
- public void should_prevent_start_equal_end2() {
- throwable.expect(IllegalArgumentException.class);
- throwable
- .expectMessage("Unable to highlight file");
-
- new DefaultHighlighting(mock(SensorStorage.class))
- .onFile(INPUT_FILE)
- .highlight(1, 10, 1, 10, KEYWORD)
- .save();
- }
-
@Test
public void should_prevent_boudaries_overlapping() {
throwable.expect(IllegalStateException.class);