Skip to content

Commit a1067c0

Browse files
refactor 144
1 parent a14efb9 commit a1067c0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.fishercoder;
2+
3+
import com.fishercoder.common.classes.TreeNode;
4+
import com.fishercoder.common.utils.CommonUtils;
5+
import com.fishercoder.common.utils.TreeUtils;
6+
import com.fishercoder.solutions._144;
7+
import org.junit.BeforeClass;
8+
import org.junit.Test;
9+
10+
import java.util.Arrays;
11+
import java.util.List;
12+
13+
public class _144Test {
14+
private static _144.Solution1 solution1;
15+
private static _144.Solution2 solution2;
16+
private static TreeNode root;
17+
private static List<Integer> inorder;
18+
19+
@BeforeClass
20+
public static void setup() {
21+
solution1 = new _144.Solution1();
22+
solution2 = new _144.Solution2();
23+
}
24+
25+
@Test
26+
public void test1() {
27+
root = TreeUtils.constructBinaryTree(Arrays.asList(3, 1, null, null, 5, 2, null, null, 4));
28+
inorder = solution1.preorderTraversal(root);
29+
CommonUtils.printList(inorder);
30+
}
31+
32+
@Test
33+
public void test2() {
34+
root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, 4, null, 5, 6, null, 7, null, null, null, null, 8, 9));
35+
TreeUtils.printBinaryTree(root);
36+
inorder = solution1.preorderTraversal(root);
37+
CommonUtils.printList(inorder);
38+
}
39+
40+
}

0 commit comments

Comments
 (0)