public static IntStream allLinesFor(DefaultIssue issue, String componentUuid) {
    DbIssues.Locations locations = issue.getLocations();
    if (locations == null) {
      return IntStream.empty();
    }

    Stream<DbCommons.TextRange> textRanges = Stream.concat(
      locations.hasTextRange() ? Stream.of(locations.getTextRange()) : Stream.empty(),
      locations.getFlowList().stream()
        .flatMap(f -> f.getLocationList().stream())
        .filter(l -> Objects.equals(componentIdOf(issue, l), componentUuid))
        .map(DbIssues.Location::getTextRange));
    return textRanges.flatMapToInt(range -> IntStream.rangeClosed(range.getStartLine(), range.getEndLine()));
  }
@Test
  public void allLinesFor_returns_empty_if_no_locations_are_set() {
    DefaultIssue issue = new DefaultIssue().setLocations(null);

    assertThat(IssueLocations.allLinesFor(issue, "file1")).isEmpty();
  }