Skip to content

Commit 20a66fd

Browse files
refactor 145
1 parent f243b89 commit 20a66fd

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/test/java/com/fishercoder/_145Test.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,24 @@
1212
import static org.junit.Assert.assertEquals;
1313

1414
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;
1819

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+
}
2325

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+
}
3235
}

0 commit comments

Comments
 (0)