@Test public void testGitDiffCommand_FileTypeFilterIsAdded() throws SourceControlException { RevisionScope<ObjectId> scope = revisionResolver.resolve("ec302a13", "ec302a13"); PowerMockito.when(GitDiffRunner.buildDiffCommand(scope)).thenCallRealMethod(); String[] expectedCommand = GitDiffRunner.buildDiffCommand(scope); assertTrue(Arrays.asList(expectedCommand).contains("--")); assertTrue(Arrays.asList(expectedCommand).contains("\"***" + FileExtensions.FEATURE.extension() + "\"")); }
static String[] buildDiffCommand(RevisionScope<ObjectId> revisionScope) { ObjectId fromRevision = revisionScope.getFrom(); ObjectId toRevision = revisionScope.getTo(); List<String> command = new ArrayList<>(); command.add("git"); command.add("diff"); command.add("-U1"); command.add(toRevision.equals(fromRevision)? fromRevision.getName() + '~' : fromRevision.getName()); if (!toRevision.equals(ObjectId.zeroId())) { command.add(toRevision.getName()); } addFileTypeFilters(command); return command.toArray(new String[0]); }
GitDiffRunner { static String[] buildDiffCommand(RevisionScope<ObjectId> revisionScope) { ObjectId fromRevision = revisionScope.getFrom(); ObjectId toRevision = revisionScope.getTo(); List<String> command = new ArrayList<>(); command.add("git"); command.add("diff"); command.add("-U1"); command.add(toRevision.equals(fromRevision)? fromRevision.getName() + '~' : fromRevision.getName()); if (!toRevision.equals(ObjectId.zeroId())) { command.add(toRevision.getName()); } addFileTypeFilters(command); return command.toArray(new String[0]); } }
GitDiffRunner { static String[] buildDiffCommand(RevisionScope<ObjectId> revisionScope) { ObjectId fromRevision = revisionScope.getFrom(); ObjectId toRevision = revisionScope.getTo(); List<String> command = new ArrayList<>(); command.add("git"); command.add("diff"); command.add("-U1"); command.add(toRevision.equals(fromRevision)? fromRevision.getName() + '~' : fromRevision.getName()); if (!toRevision.equals(ObjectId.zeroId())) { command.add(toRevision.getName()); } addFileTypeFilters(command); return command.toArray(new String[0]); } private  GitDiffRunner(); }
GitDiffRunner { static String[] buildDiffCommand(RevisionScope<ObjectId> revisionScope) { ObjectId fromRevision = revisionScope.getFrom(); ObjectId toRevision = revisionScope.getTo(); List<String> command = new ArrayList<>(); command.add("git"); command.add("diff"); command.add("-U1"); command.add(toRevision.equals(fromRevision)? fromRevision.getName() + '~' : fromRevision.getName()); if (!toRevision.equals(ObjectId.zeroId())) { command.add(toRevision.getName()); } addFileTypeFilters(command); return command.toArray(new String[0]); } private  GitDiffRunner(); static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope); }
GitDiffRunner { static String[] buildDiffCommand(RevisionScope<ObjectId> revisionScope) { ObjectId fromRevision = revisionScope.getFrom(); ObjectId toRevision = revisionScope.getTo(); List<String> command = new ArrayList<>(); command.add("git"); command.add("diff"); command.add("-U1"); command.add(toRevision.equals(fromRevision)? fromRevision.getName() + '~' : fromRevision.getName()); if (!toRevision.equals(ObjectId.zeroId())) { command.add(toRevision.getName()); } addFileTypeFilters(command); return command.toArray(new String[0]); } private  GitDiffRunner(); static List<Diff> diff(Repository repository, RevisionScope<ObjectId> revisionScope);  }