Skip to content

Commit 3bb6e8a

Browse files
fix tests for 298
1 parent c3fc701 commit 3bb6e8a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/test/java/com/fishercoder/_298Test.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.fishercoder.common.classes.TreeNode;
44
import com.fishercoder.common.utils.TreeUtils;
55
import com.fishercoder.solutions._298;
6-
import org.junit.BeforeClass;
76
import org.junit.Test;
87

98
import java.util.Arrays;
@@ -14,28 +13,29 @@ public class _298Test {
1413
private static _298.Solution1 solution1;
1514
private static _298.Solution2 solution2;
1615

17-
@BeforeClass
18-
public static void setup() {
19-
solution1 = new _298.Solution1();
20-
solution2 = new _298.Solution2();
21-
}
22-
2316
@Test
2417
public void test1() {
18+
solution1 = new _298.Solution1();
19+
solution2 = new _298.Solution2();
2520
TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, null, 3, 2, 4, null, null, null, 5));
2621
assertEquals(3, solution1.longestConsecutive(root));
2722
assertEquals(3, solution2.longestConsecutive(root));
2823
}
2924

3025
@Test
3126
public void test2() {
27+
solution1 = new _298.Solution1();
28+
solution2 = new _298.Solution2();
3229
TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(2, null, 3, 2, null, 1));
30+
TreeUtils.printBinaryTree(root);
3331
assertEquals(2, solution1.longestConsecutive(root));
3432
assertEquals(2, solution2.longestConsecutive(root));
3533
}
3634

3735
@Test
3836
public void test3() {
37+
solution1 = new _298.Solution1();
38+
solution2 = new _298.Solution2();
3939
TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, null, null, 4, 4, null, 5, null, null, 6));
4040
TreeUtils.printBinaryTree(root);
4141
assertEquals(4, solution1.longestConsecutive(root));

0 commit comments

Comments
 (0)