@Test public void parsePathInBraces() throws Exception { String line = "rename app/src/main/{groovy/com/nbossard/packlist/gui/AboutActivity.groovy => java/com/nbossard/packlist/gui/AboutActivity.java} (59%)"; GitRename result = GitRename.parseRenamed(line); assertEquals("app/src/main/groovy/com/nbossard/packlist/gui/AboutActivity.groovy", result.oldFile); assertEquals("app/src/main/java/com/nbossard/packlist/gui/AboutActivity.java", result.newFile); assertEquals(59, result.similarity); }
public static GitRename parseRenamed(String line) throws Exception { line = line.trim(); if (line.startsWith("rename")) { GitRename rename; if (line.contains("{")) { rename = parseWithBraces(line); if (rename != null) { return rename; } } else { rename = parseWithoutBraces(line); if (rename != null) { return rename; } } } throw new Exception("Unable to parse line: " + line); }
GitRename { public static GitRename parseRenamed(String line) throws Exception { line = line.trim(); if (line.startsWith("rename")) { GitRename rename; if (line.contains("{")) { rename = parseWithBraces(line); if (rename != null) { return rename; } } else { rename = parseWithoutBraces(line); if (rename != null) { return rename; } } } throw new Exception("Unable to parse line: " + line); } }
GitRename { public static GitRename parseRenamed(String line) throws Exception { line = line.trim(); if (line.startsWith("rename")) { GitRename rename; if (line.contains("{")) { rename = parseWithBraces(line); if (rename != null) { return rename; } } else { rename = parseWithoutBraces(line); if (rename != null) { return rename; } } } throw new Exception("Unable to parse line: " + line); } GitRename(String oldFile, String newFile, int similarity); }
GitRename { public static GitRename parseRenamed(String line) throws Exception { line = line.trim(); if (line.startsWith("rename")) { GitRename rename; if (line.contains("{")) { rename = parseWithBraces(line); if (rename != null) { return rename; } } else { rename = parseWithoutBraces(line); if (rename != null) { return rename; } } } throw new Exception("Unable to parse line: " + line); } GitRename(String oldFile, String newFile, int similarity); static GitRename parseRenamed(String line); @Override String toString(); }
GitRename { public static GitRename parseRenamed(String line) throws Exception { line = line.trim(); if (line.startsWith("rename")) { GitRename rename; if (line.contains("{")) { rename = parseWithBraces(line); if (rename != null) { return rename; } } else { rename = parseWithoutBraces(line); if (rename != null) { return rename; } } } throw new Exception("Unable to parse line: " + line); } GitRename(String oldFile, String newFile, int similarity); static GitRename parseRenamed(String line); @Override String toString(); final String oldFile; final String newFile; final int similarity; }