33import com .fishercoder .common .classes .TreeNode ;
44import com .fishercoder .common .utils .TreeUtils ;
55import com .fishercoder .solutions ._298 ;
6- import org .junit .BeforeClass ;
76import org .junit .Test ;
87
98import java .util .Arrays ;
@@ -14,28 +13,29 @@ public class _298Test {
1413private static _298 .Solution1 solution1 ;
1514private 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
2417public void test1 () {
18+ solution1 =new _298 .Solution1 ();
19+ solution2 =new _298 .Solution2 ();
2520TreeNode root =TreeUtils .constructBinaryTree (Arrays .asList (1 ,null ,3 ,2 ,4 ,null ,null ,null ,5 ));
2621assertEquals (3 ,solution1 .longestConsecutive (root ));
2722assertEquals (3 ,solution2 .longestConsecutive (root ));
2823 }
2924
3025@ Test
3126public void test2 () {
27+ solution1 =new _298 .Solution1 ();
28+ solution2 =new _298 .Solution2 ();
3229TreeNode root =TreeUtils .constructBinaryTree (Arrays .asList (2 ,null ,3 ,2 ,null ,1 ));
30+ TreeUtils .printBinaryTree (root );
3331assertEquals (2 ,solution1 .longestConsecutive (root ));
3432assertEquals (2 ,solution2 .longestConsecutive (root ));
3533 }
3634
3735@ Test
3836public void test3 () {
37+ solution1 =new _298 .Solution1 ();
38+ solution2 =new _298 .Solution2 ();
3939TreeNode root =TreeUtils .constructBinaryTree (Arrays .asList (1 ,2 ,3 ,null ,null ,4 ,4 ,null ,5 ,null ,null ,6 ));
4040TreeUtils .printBinaryTree (root );
4141assertEquals (4 ,solution1 .longestConsecutive (root ));