public static Optional<DbScmInfo> create(List<DbFileSources.Line> lines, int lineCount, String fileHash) {
    LineToChangeset lineToChangeset = new LineToChangeset();
    Changeset[] lineChanges = new Changeset[lineCount];

    boolean lineAdded = false;

    for (DbFileSources.Line line : lines) {
      Changeset changeset = lineToChangeset.apply(line);
      if (changeset == null) {
        continue;
      }
      lineChanges[line.getLine() - 1] = changeset;
      lineAdded = true;
    }
    if (!lineAdded) {
      return Optional.empty();
    }
    return Optional.of(new DbScmInfo(new ScmInfoImpl(lineChanges), fileHash));
  }
@Test
  public void return_absent_dsm_info_when_no_changeset() {
    DbFileSources.Data.Builder fileDataBuilder = DbFileSources.Data.newBuilder();
    fileDataBuilder.addLinesBuilder().setLine(1);

    assertThat(DbScmInfo.create(fileDataBuilder.getLinesList(), 1, "hash")).isNotPresent();
  }