Example usage for org.eclipse.jgit.diff EditList singleton

List of usage examples for org.eclipse.jgit.diff EditList singleton

Introduction

In this page you can find the example usage for org.eclipse.jgit.diff EditList singleton.

Prototype

public static EditList singleton(Edit edit) 

Source Link

Document

Construct an edit list containing a single edit.

Usage

From source file:com.google.gerrit.server.patch.IntraLineLoaderTest.java

License:Apache License

private static List<Edit> intraline(String a, String b, Edit lines) throws Exception {
    Text aText = new Text(a.getBytes(UTF_8));
    Text bText = new Text(b.getBytes(UTF_8));

    IntraLineDiff diff;//from ww w .ja va 2  s  .c  om
    diff = IntraLineLoader.compute(aText, bText, EditList.singleton(lines));

    assertThat(diff.getStatus()).isEqualTo(IntraLineDiff.Status.EDIT_LIST);
    List<Edit> actualEdits = diff.getEdits();
    assertThat(actualEdits).hasSize(1);
    Edit actualEdit = actualEdits.get(0);
    assertThat(actualEdit.getBeginA()).isEqualTo(lines.getBeginA());
    assertThat(actualEdit.getEndA()).isEqualTo(lines.getEndA());
    assertThat(actualEdit.getBeginB()).isEqualTo(lines.getBeginB());
    assertThat(actualEdit.getEndB()).isEqualTo(lines.getEndB());
    assertThat(actualEdit).isInstanceOf(ReplaceEdit.class);

    return ((ReplaceEdit) actualEdit).getInternalEdits();
}

From source file:com.google.gerrit.server.patch.IntraLineLoaderTest.java

License:Apache License

private static List<Edit> wordEdit(int as, int ae, int bs, int be) {
    return EditList.singleton(new Edit(as, ae, bs, be));
}