@Test(expected = SourceControlException.class) public void testDiff_invalidDiffResult() throws IOException, SourceControlException { mockStatic(ProcessRunner.class); List<String> diffLines = ResourceFileUtils.getResourceFileContentAsList(getClass(), "gitDiffInvalid.out"); when(ProcessRunner.runCommand(any(), any())).thenReturn(diffLines); RevisionScope<ObjectId> scope = revisionResolver.resolve("44444444", "55555555"); GitDiffRunner.diff(repository, scope); assertTrue(true); }
public static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope) throws SourceControlException { String[] command = buildDiffCommand(revisionScope); try { List<String> diffLines = ProcessRunner.runCommand(getRepositoryBaseFolder(repository), command); byte[] diffBytes = pad(diffLines); return new UnifiedDiffParser().parse(diffBytes); } catch (IOException e) { throw new SourceControlException("Error running git diff command", e); } }
GitDiffRunner { public static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope) throws SourceControlException { String[] command = buildDiffCommand(revisionScope); try { List<String> diffLines = ProcessRunner.runCommand(getRepositoryBaseFolder(repository), command); byte[] diffBytes = pad(diffLines); return new UnifiedDiffParser().parse(diffBytes); } catch (IOException e) { throw new SourceControlException("Error running git diff command", e); } } }
GitDiffRunner { public static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope) throws SourceControlException { String[] command = buildDiffCommand(revisionScope); try { List<String> diffLines = ProcessRunner.runCommand(getRepositoryBaseFolder(repository), command); byte[] diffBytes = pad(diffLines); return new UnifiedDiffParser().parse(diffBytes); } catch (IOException e) { throw new SourceControlException("Error running git diff command", e); } } private  GitDiffRunner(); }
GitDiffRunner { public static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope) throws SourceControlException { String[] command = buildDiffCommand(revisionScope); try { List<String> diffLines = ProcessRunner.runCommand(getRepositoryBaseFolder(repository), command); byte[] diffBytes = pad(diffLines); return new UnifiedDiffParser().parse(diffBytes); } catch (IOException e) { throw new SourceControlException("Error running git diff command", e); } } private  GitDiffRunner(); static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope); }
GitDiffRunner { public static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope) throws SourceControlException { String[] command = buildDiffCommand(revisionScope); try { List<String> diffLines = ProcessRunner.runCommand(getRepositoryBaseFolder(repository), command); byte[] diffBytes = pad(diffLines); return new UnifiedDiffParser().parse(diffBytes); } catch (IOException e) { throw new SourceControlException("Error running git diff command", e); } } private  GitDiffRunner(); static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope);  }