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