use of com.virtuslab.branchlayout.api.IBranchLayoutEntry in project git-machete-intellij-plugin by VirtusLab.
the class BranchLayoutTestSuite method withBranchSlideOut_givenNonRootExistingBranch_slidesOut.
@Test
public void withBranchSlideOut_givenNonRootExistingBranch_slidesOut() {
// given
String rootName = "root";
String branchToSlideOutName = "parent";
String childName0 = "child0";
String childName1 = "child1";
/*-
root root
parent slide out
child0 -----> child0
child1 child1
*/
List<IBranchLayoutEntry> childBranches = List.of(new BranchLayoutEntry(childName0, /* customAnnotation */
null, List.empty()), new BranchLayoutEntry(childName1, /* customAnnotation */
null, List.empty()));
val entry = new BranchLayoutEntry(branchToSlideOutName, /* customAnnotation */
null, childBranches);
val rootEntry = new BranchLayoutEntry(rootName, /* customAnnotation */
null, List.of(entry));
val branchLayout = new BranchLayout(List.of(rootEntry));
// when
IBranchLayout result = branchLayout.slideOut(branchToSlideOutName);
// then
assertEquals(result.getRootEntries().size(), 1);
assertEquals(result.getRootEntries().get(0).getName(), rootName);
val children = result.getRootEntries().get(0).getChildren();
assertEquals(children.size(), 2);
assertEquals(children.get(0).getName(), childName0);
assertEquals(children.get(1).getName(), childName1);
}
Aggregations