use of com.google.gerrit.server.edit.tree.TreeModification in project gerrit by GerritCodeReview.
the class FixReplacementInterpreterTest method replacementsCanDeleteALine.
@Test
public void replacementsCanDeleteALine() throws Exception {
FixReplacement fixReplacement = new FixReplacement(filePath1, new Range(2, 0, 3, 0), "");
mockFileContent(filePath1, "First line\nSecond line\nThird line\n");
replay(fileContentUtil);
List<TreeModification> treeModifications = toTreeModifications(fixReplacement);
assertThatList(treeModifications).onlyElement().asChangeFileContentModification().newContent().isEqualTo("First line\nThird line\n");
}
use of com.google.gerrit.server.edit.tree.TreeModification in project gerrit by GerritCodeReview.
the class FixReplacementInterpreterTest method replacementsMayOccurOnSameLine.
@Test
public void replacementsMayOccurOnSameLine() throws Exception {
FixReplacement fixReplacement1 = new FixReplacement(filePath1, new Range(2, 0, 2, 6), "A");
FixReplacement fixReplacement2 = new FixReplacement(filePath1, new Range(2, 7, 2, 11), "modification");
mockFileContent(filePath1, "First line\nSecond line\nThird line\n");
replay(fileContentUtil);
List<TreeModification> treeModifications = toTreeModifications(fixReplacement1, fixReplacement2);
assertThatList(treeModifications).onlyElement().asChangeFileContentModification().newContent().isEqualTo("First line\nA modification\nThird line\n");
}
Aggregations