@Override
  public void publish(ScannerReportWriter writer) {
    Optional<String> targetBranch = getTargetBranch();
    if (targetBranch.isPresent()) {
      Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
      int count = writeChangedLines(scmConfiguration.provider(), writer, targetBranch.get());
      LOG.debug("SCM reported changed lines for {} {} in the branch", count, ScannerUtils.pluralize("file", count));
      profiler.stopInfo();
    }
  }
@Test
  public void write_changed_file_with_GitScmProvider() {
    GitScmProvider provider = mock(GitScmProvider.class);
    when(scmConfiguration.provider()).thenReturn(provider);
    Set<Integer> lines = new HashSet<>(Arrays.asList(1, 10));
    when(provider.branchChangedLines(eq(TARGET_BRANCH), eq(BASE_DIR), anySet()))
      .thenReturn(ImmutableMap.of(BASE_DIR.resolve("path1"), lines, BASE_DIR.resolve("path3"), Collections.emptySet()));

    publisher.publish(writer);

    verify(provider).branchChangedLinesWithFileMovementDetection(eq(TARGET_BRANCH), eq(BASE_DIR), anyMap());
  }