use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentNoEOLTest method deleteAtStart.
@Test
public void deleteAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line", 1, 0, 1, 4, "");
assertThat(fixResult).text().isEqualTo("t line");
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);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentNoEOLTest method deleteAtEnd.
@Test
public void deleteAtEnd() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line", 1, 7, 1, 10, "");
assertThat(fixResult).text().isEqualTo("First l");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isDelete(7, 3, 7);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentNoEOLTest method replaceWholeContent.
@Test
public void replaceWholeContent() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line", 1, 0, 1, 10, "Abc");
assertThat(fixResult).text().isEqualTo("Abc");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isReplace(0, 10, 0, 3);
}
use of com.google.gerrit.server.fixes.FixCalculator.FixResult in project gerrit by GerritCodeReview.
the class OneLineContentNoEOLTest method replaceWithSingleLineWithEOLAtStart.
@Test
public void replaceWithSingleLineWithEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line", 1, 0, 1, 2, "Abc\n");
assertThat(fixResult).text().isEqualTo("Abc\nrst line");
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 replaceWithSingleLineNoEOLAtStart.
@Test
public void replaceWithSingleLineNoEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 0, 1, 2, "Abc");
assertThat(fixResult).text().isEqualTo("Abcrst 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);
}