use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method replaceMultilineLineWithEOLInTheMiddle.
@Test
public void replaceMultilineLineWithEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 3, 1, 5, "Abc\nDefgh\n");
assertThat(fixResult).text().isEqualTo("FirAbc\nDefgh\n line\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 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 OneLineContentWithEOLTest method replaceWithSingleLineWithEOLInTheMiddle.
@Test
public void replaceWithSingleLineWithEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 3, 1, 5, "Abc\n");
assertThat(fixResult).text().isEqualTo("FirAbc\n line\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 2);
assertThat(edit).internalEdits().onlyElement().isReplace(3, 2, 3, 4);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class EmptyContentTest method insertSingleLineWithEOL.
@Test
public void insertSingleLineWithEOL() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("", 1, 0, 1, 0, "Abc\n");
assertThat(fixResult).text().isEqualTo("Abc\n");
assertThat(fixResult).edits().onlyElement();
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 EmptyContentTest method insertMultilineWithEOL.
@Test
public void insertMultilineWithEOL() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("", 1, 0, 1, 0, "Abc\nDEFGH\n");
assertThat(fixResult).text().isEqualTo("Abc\nDEFGH\n");
assertThat(fixResult).edits().onlyElement();
Edit edit = fixResult.edits.get(0);
assertThat(edit).isInsert(0, 0, 2);
assertThat(edit).internalEdits().onlyElement().isInsert(0, 0, 10);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method replaceWithSingleLineWithEOLAtStart.
@Test
public void replaceWithSingleLineWithEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 1, 0, 1, 2, "Abc\n");
assertThat(fixResult).text().isEqualTo("Abc\nrst line\nSecond line\nThird line");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 2);
assertThat(edit).internalEdits().onlyElement().isReplace(0, 2, 0, 4);
}