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