use of org.eclipse.jgit.diff.Edit 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 org.eclipse.jgit.diff.Edit 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 org.eclipse.jgit.diff.Edit 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);
}
use of org.eclipse.jgit.diff.Edit in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method replaceWithSingleLineWithEOLAtEnd.
@Test
public void replaceWithSingleLineWithEOLAtEnd() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 8, 2, 0, "Abc\n");
assertThat(fixResult).text().isEqualTo("First liAbc\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isReplace(8, 3, 8, 4);
}
use of org.eclipse.jgit.diff.Edit in project gerrit by GerritCodeReview.
the class OneLineContentWithEOLTest method insertSingleLineNoEOLAtStart.
@Test
public void insertSingleLineNoEOLAtStart() throws Exception {
FixResult fixResult = FixCalculatorVariousTest.calculateFixSingleReplacement("First line\n", 1, 0, 1, 0, "Abc");
assertThat(fixResult).text().isEqualTo("AbcFirst line\n");
assertThat(fixResult).edits().hasSize(1);
Edit edit = fixResult.edits.get(0);
assertThat(edit).isReplace(0, 1, 0, 1);
assertThat(edit).internalEdits().onlyElement().isInsert(0, 0, 3);
}
Aggregations