BAEL-4864: Fix traverseInOrderWithoutRecursion method (#10588)

Co-authored-by: Krzysztof Woyke <krzysztof.woyke.sp@lhsystems.com>
This commit is contained in:
kwoyke
2021-03-24 22:09:02 +01:00
committed by GitHub
parent 9a580ea9fc
commit 23503a0673
2 changed files with 53 additions and 30 deletions
@@ -13,7 +13,7 @@ public class BinaryTreeUnitTest {
BinaryTree bt = createBinaryTree();
assertTrue(!bt.isEmpty());
assertFalse(bt.isEmpty());
}
@Test
@@ -72,6 +72,7 @@ public class BinaryTreeUnitTest {
@Test
public void it_deletes_the_root() {
int value = 12;
BinaryTree bt = new BinaryTree();
bt.add(value);
@@ -91,6 +92,14 @@ public class BinaryTreeUnitTest {
bt.traverseInOrderWithoutRecursion();
}
@Test
public void givenAnEmptyBinaryTree_WhenTraversingInOrderWithoutRecursion_ThenNoException() {
BinaryTree empty = new BinaryTree();
empty.traverseInOrderWithoutRecursion();
}
@Test
public void givenABinaryTree_WhenTraversingPreOrder_ThenPrintValues() {
@@ -101,6 +110,14 @@ public class BinaryTreeUnitTest {
bt.traversePreOrderWithoutRecursion();
}
@Test
public void givenAnEmptyBinaryTree_WhenTraversingPreOrderWithoutRecursion_ThenNoException() {
BinaryTree empty = new BinaryTree();
empty.traversePreOrderWithoutRecursion();
}
@Test
public void givenABinaryTree_WhenTraversingPostOrder_ThenPrintValues() {
@@ -111,6 +128,14 @@ public class BinaryTreeUnitTest {
bt.traversePostOrderWithoutRecursion();
}
@Test
public void givenAnEmptyBinaryTree_WhenTraversingPostOrderWithoutRecursion_ThenNoException() {
BinaryTree empty = new BinaryTree();
empty.traversePostOrderWithoutRecursion();
}
@Test
public void givenABinaryTree_WhenTraversingLevelOrder_ThenPrintValues() {