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