use of com.virtuslab.branchlayout.api.BranchLayout in project git-machete-intellij-plugin by VirtusLab.
the class BranchLayoutTestSuite method withBranchSlideOut_givenRootBranchWithChildren_slidesOut.
@Test
public void withBranchSlideOut_givenRootBranchWithChildren_slidesOut() {
// given
String rootName = "root";
String childName0 = "child0";
String childName1 = "child1";
/*-
root 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(rootName, /* customAnnotation */
null, childBranches);
val branchLayout = new BranchLayout(List.of(entry));
// when
IBranchLayout result = branchLayout.slideOut(rootName);
// then
assertEquals(result.getRootEntries().size(), 2);
assertEquals(result.getRootEntries().get(0).getName(), childName0);
assertEquals(result.getRootEntries().get(1).getName(), childName1);
}
use of com.virtuslab.branchlayout.api.BranchLayout in project git-machete-intellij-plugin by VirtusLab.
the class BranchLayoutFileReaderTestSuite method read_givenCorrectFile_reads.
@Test
@SneakyThrows
public void read_givenCorrectFile_reads() {
// given
List<String> linesToReturn = List.of(" ", "A", " B", "C", "");
BranchLayoutFileReader reader = getBranchLayoutFileReaderForLines(linesToReturn, /* indentWidth */
1);
// when
BranchLayout branchLayout = reader.read(path);
// then
Assert.assertTrue(branchLayout.findEntryByName("A").isDefined());
Assert.assertTrue(branchLayout.findEntryByName("B").isDefined());
Assert.assertTrue(branchLayout.findEntryByName("C").isDefined());
Assert.assertEquals(2, branchLayout.getRootEntries().size());
}
use of com.virtuslab.branchlayout.api.BranchLayout in project git-machete-intellij-plugin by VirtusLab.
the class BranchLayoutFileReaderTestSuite method read_givenCorrectFileWithRootsOnly_reads.
@Test
@SneakyThrows
public void read_givenCorrectFileWithRootsOnly_reads() {
// given
List<String> linesToReturn = List.of("A", " ", "B");
BranchLayoutFileReader reader = getBranchLayoutFileReaderForLines(linesToReturn, /* indentWidth */
1);
// when
BranchLayout branchLayout = reader.read(path);
// then
Assert.assertTrue(branchLayout.findEntryByName("A").isDefined());
Assert.assertTrue(branchLayout.findEntryByName("B").isDefined());
Assert.assertEquals(2, branchLayout.getRootEntries().size());
}
use of com.virtuslab.branchlayout.api.BranchLayout in project git-machete-intellij-plugin by VirtusLab.
the class BranchLayoutTestSuite method withBranchSlideOut_givenSingleRootBranch_slidesOut.
@Test
public void withBranchSlideOut_givenSingleRootBranch_slidesOut() {
// given
val rootName = "root";
/*-
root slide out
----->
*/
val entry = new BranchLayoutEntry(rootName, /* customAnnotation */
null, List.empty());
val branchLayout = new BranchLayout(List.of(entry));
// when
IBranchLayout result = branchLayout.slideOut(rootName);
// then
assertEquals(result.getRootEntries().size(), 0);
}
use of com.virtuslab.branchlayout.api.BranchLayout in project git-machete-intellij-plugin by VirtusLab.
the class BranchLayoutTestSuite method withBranchSlideOut_givenNonExistingBranch_noExceptionThrown.
@Test
public void withBranchSlideOut_givenNonExistingBranch_noExceptionThrown() {
// given
val branchToSlideOutName = "branch";
val branchLayout = new BranchLayout(List.empty());
// when
IBranchLayout result = branchLayout.slideOut(branchToSlideOutName);
// then no exception thrown
Assert.assertTrue(result.getRootEntries().isEmpty());
}
Aggregations