use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method replaceMultilineLineWithEOLInTheMiddle.
@Test
public void replaceMultilineLineWithEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 2, 3, 2, 5, "Abc\nDefgh\n");
assertThat(fixResult).text().isEqualTo("First line\nSecAbc\nDefgh\nd line\nThird line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(1, 1, 1, 3);
assertThat(edit).internalEdits().onlyElement().isReplace(3, 2, 3, 10);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method replaceMultilineLineNoEOLInTheMiddle.
@Test
public void replaceMultilineLineNoEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 2, 3, 2, 5, "Abc\nDefgh");
assertThat(fixResult).text().isEqualTo("First line\nSecAbc\nDefghd line\nThird line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(1, 1, 1, 2);
assertThat(edit).internalEdits().onlyElement().isReplace(3, 2, 3, 9);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method deleteInTheMiddle.
@Test
public void deleteInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 1, 5, 3, 1, "");
assertThat(fixResult).text().isEqualTo("Firsthird line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 3, 0, 1);
assertThat(edit).internalEdits().onlyElement().isDelete(5, 19, 5);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method replaceMultilineLineWithEOLAtStart.
@Test
public void replaceMultilineLineWithEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 1, 0, 1, 2, "Abc\nDefgh\n");
assertThat(fixResult).text().isEqualTo("Abc\nDefgh\nrst line\nSecond line\nThird line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 3);
assertThat(edit).internalEdits().onlyElement().isReplace(0, 2, 0, 10);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method deleteAtEnd.
@Test
public void deleteAtEnd() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 3, 7, 3, 10, "");
assertThat(fixResult).text().isEqualTo("First line\nSecond line\nThird l");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(2, 1, 2, 1);
assertThat(edit).internalEdits().onlyElement().isDelete(7, 3, 7);
}