@Test
  public void compute_syntax_highlighting() throws Exception {
    BatchReportWriter writer = initReport();

    writer.writeComponentSyntaxHighlighting(
        FILE_REF,
        newArrayList(
            BatchReport.SyntaxHighlighting.HighlightingRule.newBuilder()
                .setRange(
                    BatchReport.Range.newBuilder()
                        .setStartLine(1)
                        .setStartOffset(3)
                        .setEndLine(1)
                        .setEndOffset(5)
                        .build())
                .setType(Constants.HighlightingType.ANNOTATION)
                .build(),
            BatchReport.SyntaxHighlighting.HighlightingRule.newBuilder()
                .setRange(
                    BatchReport.Range.newBuilder()
                        .setStartLine(3)
                        .setStartOffset(6)
                        .setEndLine(3)
                        .setEndOffset(7)
                        .build())
                .setType(Constants.HighlightingType.COMMENT)
                .build()));

    step.execute(
        new ComputationContext(new BatchReportReader(reportDir), mock(ComponentDto.class)));

    assertThat(step.getSyntaxHighlightingByLine()).hasSize(2);
    assertThat(step.getSyntaxHighlightingByLine().get(1).toString()).isEqualTo("3,5,ANNOTATION");
    assertThat(step.getSyntaxHighlightingByLine().get(3).toString()).isEqualTo("6,7,COMMENT");
  }
  @Test
  public void verify_readComponentSyntaxHighlighting() {
    writer.writeComponentSyntaxHighlighting(
        COMPONENT_REF, of(SYNTAX_HIGHLIGHTING_1, SYNTAX_HIGHLIGHTING_2));

    CloseableIterator<BatchReport.SyntaxHighlighting> res =
        underTest.readComponentSyntaxHighlighting(COMPONENT_REF);
    assertThat(res).containsExactly(SYNTAX_HIGHLIGHTING_1, SYNTAX_HIGHLIGHTING_2);
    res.close();
  }
  @Test(expected = IllegalStateException.class)
  public void fail_when_range_is_defined_on_different_line() throws Exception {
    BatchReportWriter writer = initReport();

    writer.writeComponentSyntaxHighlighting(
        FILE_REF,
        newArrayList(
            BatchReport.SyntaxHighlighting.HighlightingRule.newBuilder()
                .setRange(
                    BatchReport.Range.newBuilder()
                        .setStartLine(1)
                        .setStartOffset(3)
                        .setEndLine(2)
                        .setEndOffset(2)
                        .build())
                .setType(Constants.HighlightingType.ANNOTATION)
                .build()));

    step.execute(
        new ComputationContext(new BatchReportReader(reportDir), mock(ComponentDto.class)));
  }