use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentWithEOLTest method deleteWholeContent.
@Test
public void deleteWholeContent() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 1, 0, 4, 0, "");
assertThat(fixResult).text().isEqualTo("");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isDelete(0, 3, 0);
assertThat(edit).internalEdits().onlyElement().isDelete(0, 34, 0);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentWithEOLTest method insertSingleLineNoEOLAtStart.
@Test
public void insertSingleLineNoEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 1, 0, 1, 0, "Abc");
assertThat(fixResult).text().isEqualTo("AbcFirst line\nSecond line\nThird line\n");
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 MultilineContentWithEOLTest method insertSingleLineNoEOLAtEnd.
@Test
public void insertSingleLineNoEOLAtEnd() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 4, 0, 4, 0, "Abc");
assertThat(fixResult).text().isEqualTo("First line\nSecond line\nThird line\nAbc");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isInsert(3, 3, 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 MultilineContentWithEOLTest method insertSingleLineWithEOLAtStart.
@Test
public void insertSingleLineWithEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 1, 0, 1, 0, "Abc\n");
assertThat(fixResult).text().isEqualTo("Abc\nFirst line\nSecond line\nThird line\n");
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 MultilineContentWithEOLTest method insertMultilineLineWithEOLAtStart.
@Test
public void insertMultilineLineWithEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 1, 0, 1, 0, "Abc\nDefgh\n");
assertThat(fixResult).text().isEqualTo("Abc\nDefgh\nFirst line\nSecond line\nThird line\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isInsert(0, 0, 2);
assertThat(edit).internalEdits().onlyElement().isInsert(0, 0, 10);
}