8000 migrate _222 test to Junit5 · githubniraj/Leetcode@9177d16 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9177d16

Browse files
migrate _222 test to Junit5
1 parent 259e029 commit 9177d16

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/test/java/com/fishercoder/_222Test.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
import com.fishercoder.common.utils.TreeUtils;
66
import com.fishercoder.solutions._2007;
77
import com.fishercoder.solutions._222;
8-
import org.junit.BeforeClass;
9-
import org.junit.Test;
8+
import org.junit.jupiter.api.BeforeEach;
9+
import org.junit.jupiter.api.Test;
1010

1111
import java.util.Arrays;
1212

13-
import static org.junit.Assert.assertEquals;
13+
import static org.junit.jupiter.api.Assertions.assertEquals;
1414

1515
public class _222Test {
1616
private static _222.Solution1 solution1;
1717
private static _222.Solution2 solution2;
1818
private static int expected;
1919
private static TreeNode root;
2020

21-
@BeforeClass
22-
public static void setup() {
21+
@BeforeEach
22+
public void setup() {
2323
solution1 = new _222.Solution1();
2424
solution2 = new _222.Solution2();
2525
}
@@ -42,4 +42,13 @@ public void test2() {
4242
assertEquals(expected, solution2.countNodes(root));
4343
}
4444

45+
@Test
46+
public void test3() {
47+
root = TreeUtils.constructBinaryTree(Arrays.asList());
48+
TreeUtils.printBinaryTree(root);
49+
expected = 3;
50+
assertEquals(expected, solution1.countNodes(root));
51+
assertEquals(expected, solution2.countNodes(root));
52+
}
53+
4554
}

0 commit comments

Comments
 (0)
0