use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentNoEOLTest method insertMultilineLineWithEOLAtStart.
@Test
public void insertMultilineLineWithEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line", 1, 0, 1, 0, "Abc\nDefgh\n");
assertThat(fixResult).text().isEqualTo("Abc\nDefgh\nFirst line\nSecond line\nThird line");
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);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentWithEOLTest method replaceWithSingleLineWithEOLInTheMiddle.
@Test
public void replaceWithSingleLineWithEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 2, 3, 2, 5, "Abc\n");
assertThat(fixResult).text().isEqualTo("First line\nSecAbc\nd line\nThird line\n");
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, 4);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentWithEOLTest method replaceWithSingleLineNoEOLAtStart.
@Test
public void replaceWithSingleLineNoEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 1, 0, 1, 2, "Abc");
assertThat(fixResult).text().isEqualTo("Abcrst 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().isReplace(0, 2, 0, 3);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentWithEOLTest method replaceWithSingleLineNoEOLInTheMiddle.
@Test
public void replaceWithSingleLineNoEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 2, 3, 2, 5, "Abc");
assertThat(fixResult).text().isEqualTo("First line\nSecAbcd line\nThird line\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(1, 1, 1, 1);
assertThat(edit).internalEdits().onlyElement().isReplace(3, 2, 3, 3);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class MultilineContentWithEOLTest method deleteInTheMiddle.
@Test
public void deleteInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\nSecond line\nThird line\n", 1, 5, 3, 1, "");
assertThat(fixResult).text().isEqualTo("Firsthird line\n");
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);
}