use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method deleteInTheMiddle.
@Test
public void deleteInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 5, 1, 8, "");
assertThat(fixResult).text().isEqualTo("Firstne\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isDelete(5, 3, 5);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method insertMultilineLineWithEOLAtEnd.
@Test
public void insertMultilineLineWithEOLAtEnd() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 2, 0, 2, 0, "Abc\nDefgh\n");
assertThat(fixResult).text().isEqualTo("First line\nAbc\nDefgh\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isInsert(1, 1, 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 OneLineContentWithEOLTest method deleteWholeContent.
@Test
public void deleteWholeContent() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 0, 2, 0, "");
assertThat(fixResult).text().isEqualTo("");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isDelete(0, 1, 0);
assertThat(edit).internalEdits().onlyElement().isDelete(0, 11, 0);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method replaceWithSingleLineNoEOLInTheMiddle.
@Test
public void replaceWithSingleLineNoEOLInTheMiddle() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 3, 1, 5, "Abc");
assertThat(fixResult).text().isEqualTo("FirAbc 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(3, 2, 3, 3);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method deleteAtStart.
@Test
public void deleteAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 0, 1, 4, "");
assertThat(fixResult).text().isEqualTo("t line\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isDelete(0, 4, 0);
}