@Override
  public CloseableIterator<String> readLines(Component file) {
    requireNonNull(file, "Component should not be null");
    checkArgument(file.getType() == FILE, "Component '%s' is not a file", file);

    Optional<CloseableIterator<String>> linesIteratorOptional = reportReader.readFileSource(file.getReportAttributes().getRef());

    checkState(linesIteratorOptional.isPresent(), "File '%s' has no source code", file);
    CloseableIterator<String> lineIterator = linesIteratorOptional.get();

    return new ComponentLinesCloseableIterator(file, lineIterator, file.getFileAttributes().getLines());
  }
@Test
  public void fail_with_ISE_when_file_has_no_source() {
    assertThatThrownBy(() -> {
      underTest.readLines(builder(Component.Type.FILE, FILE_REF)
        .setKey(FILE_KEY)
        .setUuid(FILE_UUID)
        .build());
    })
      .isInstanceOf(IllegalStateException.class)
      .hasMessage("File 'ReportComponent{ref=2, key='FILE_KEY', type=FILE}' has no source code");
  }