@Override
  public Optional<ReadError> read(DbFileSources.Line.Builder lineBuilder) {
    if (readError == null) {
      try {
        processHighlightings(lineBuilder);
      } catch (RangeOffsetConverterException e) {
        readError = new ReadError(HIGHLIGHTING, lineBuilder.getLine());
        LOG.debug(format("Inconsistency detected in Highlighting data. Highlighting will be ignored for file '%s'", file.getKey()), e);
      }
    }
    return Optional.ofNullable(readError);
  }
@Test
  public void read_highlighting_declared_on_a_whole_line() {
    TextRange textRange = newTextRange(LINE_1, LINE_2);
    when(rangeOffsetConverter.offsetToString(textRange, LINE_1, DEFAULT_LINE_LENGTH)).thenReturn(RANGE_LABEL_1);
    when(rangeOffsetConverter.offsetToString(textRange, LINE_2, DEFAULT_LINE_LENGTH)).thenReturn("");

    HighlightingLineReader highlightingLineReader = newReader(of(textRange, ANNOTATION));

    assertThat(highlightingLineReader.read(line1)).isEmpty();
    assertThat(highlightingLineReader.read(line2)).isEmpty();
    assertThat(highlightingLineReader.read(line3)).isEmpty();

    assertThat(line1.getHighlighting()).isEqualTo(RANGE_LABEL_1 + ",a");
    // Nothing should be set on line 2
    assertThat(line2.getHighlighting()).isEmpty();
    assertThat(line3.getHighlighting()).isEmpty();
  }