|
12 | 12 | import static org.junit.Assert.assertEquals;
|
13 | 13 |
|
14 | 14 | public class _145Test {
|
15 |
| - private static _145 test; |
16 |
| - private static TreeNode root; |
17 |
| - private static List<Integer> expected; |
| 15 | + private static _145.Solution1 solution1; |
| 16 | + private static _145.Solution2 solution2; |
| 17 | + private static TreeNode root; |
| 18 | + private static List<Integer> expected; |
18 | 19 |
|
19 |
| - @BeforeClass |
20 |
| - public static void setup() { |
21 |
| - test = new _145(); |
22 |
| - } |
| 20 | + @BeforeClass |
| 21 | + public static void setup() { |
| 22 | + solution1 = new _145.Solution1(); |
| 23 | + solution2 = new _145.Solution2(); |
| 24 | + } |
23 | 25 |
|
24 |
| - @Test |
25 |
| - public void test1() { |
26 |
| - root = new TreeNode(1); |
27 |
| - root.left = new TreeNode(2); |
28 |
| - root.right = new TreeNode(3); |
29 |
| - expected = new ArrayList<>(Arrays.asList(2, 3, 1)); |
30 |
| - assertEquals(expected, test.postorderTraversal_recursive(root)); |
31 |
| - } |
| 26 | + @Test |
| 27 | + public void test1() { |
| 28 | + root = new TreeNode(1); |
| 29 | + root.left = new TreeNode(2); |
| 30 | + root.right = new TreeNode(3); |
| 31 | + expected = new ArrayList<>(Arrays.asList(2, 3, 1)); |
| 32 | + assertEquals(expected, solution1.postorderTraversal(root)); |
| 33 | + assertEquals(expected, solution2.postorderTraversal(root)); |
| 34 | + } |
32 | 35 | }
|
0 commit comments