use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method replaceMultilineLineWithEOLAtEnd.
@Test
public void replaceMultilineLineWithEOLAtEnd() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 3, 8, 3, 10, "Abc\nDefgh\n");
assertThat(fixResult).text().isEqualTo("First line\nSecond line\nThird liAbc\nDefgh\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(2, 1, 2, 2);
assertThat(edit).internalEdits().onlyElement().isReplace(8, 2, 8, 10);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method insertMultilineLineWithEOLAtEnd.
@Test
public void insertMultilineLineWithEOLAtEnd() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 3, 10, 3, 10, "Abc\nDefgh\n");
assertThat(fixResult).text().isEqualTo("First line\nSecond line\nThird lineAbc\nDefgh\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(2, 1, 2, 2);
assertThat(edit).internalEdits().onlyElement().isInsert(10, 10, 10);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method insertSingleLineNoEOLAtStart.
@Test
public void insertSingleLineNoEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 1, 0, 1, 0, "Abc");
assertThat(fixResult).text().isEqualTo("AbcFirst line\nSecond line\nThird line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isInsert(0, 0, 3);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method insertSingleLineWithEOLAtStart.
@Test
public void insertSingleLineWithEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 1, 0, 1, 0, "Abc\n");
assertThat(fixResult).text().isEqualTo("Abc\nFirst line\nSecond line\nThird line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isInsert(0, 0, 1);
assertThat(edit).internalEdits().onlyElement().isInsert(0, 0, 4);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method insertSingleLineWithEOLInTheMiddle.
@Test
public void insertSingleLineWithEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 2, 5, 2, 5, "Abc\n");
assertThat(fixResult).text().isEqualTo("First line\nSeconAbc\nd 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().isInsert(5, 5, 4);
}