1+ package com .fishercoder ;
2+
3+ import com .fishercoder .common .classes .TreeNode ;
4+ import com .fishercoder .common .utils .CommonUtils ;
5+ import com .fishercoder .common .utils .TreeUtils ;
6+ import com .fishercoder .solutions ._1727 ;
7+ import com .fishercoder .solutions ._623 ;
8+ import org .junit .BeforeClass ;
9+ import org .junit .Test ;
10+
11+ import java .util .Arrays ;
12+
13+ import static org .junit .Assert .assertEquals ;
14+
15+ public class _623Test {
16+ private static _623 .Solution1 solution1 ;
17+
18+ @ BeforeClass
19+ public static void setup () {
20+ solution1 =new _623 .Solution1 ();
21+ }
22+
23+ @ Test
24+ public void test1 () {
25+ TreeNode expected =TreeUtils .constructBinaryTree (Arrays .asList (4 ,1 ,1 ,2 ,null ,null ,6 ,3 ,1 ,5 ));
26+ TreeUtils .printBinaryTree (expected );
27+ TreeNode inputTree =TreeUtils .constructBinaryTree (Arrays .asList (4 ,2 ,6 ,3 ,1 ,5 ));
28+ TreeUtils .printBinaryTree (inputTree );
29+ assertEquals (expected ,solution1 .addOneRow (inputTree ,1 ,2 ));
30+ }
31+
32+ @ Test
33+ public void test2 () {
34+ TreeNode expected =TreeUtils .constructBinaryTree (Arrays .asList (4 ,2 ,null ,1 ,1 ,3 ,null ,null ,1 ));
35+ TreeUtils .printBinaryTree (expected );
36+ TreeNode inputTree =TreeUtils .constructBinaryTree (Arrays .asList (4 ,2 ,null ,3 ,1 ));
37+ TreeUtils .printBinaryTree (inputTree );
38+ assertEquals (expected ,solution1 .addOneRow (inputTree ,1 ,3 ));
39+ }
40+
41+ @ Test
42+ public void test3 () {
43+ TreeNode expected =TreeUtils .constructBinaryTree (Arrays .asList (4 ,2 ,5 ,1 ,1 ,1 ,1 ,3 ,null ,null ,1 ,6 ,null ,null ,7 ));
44+ TreeUtils .printBinaryTree (expected );
45+ TreeNode inputTree =TreeUtils .constructBinaryTree (Arrays .asList (4 ,2 ,5 ,3 ,1 ,6 ,7 ));
46+ TreeUtils .printBinaryTree (inputTree );
47+ TreeNode actual =solution1 .addOneRow (inputTree ,1 ,3 );
48+ TreeUtils .printBinaryTree (actual );
49+ assertEquals (expected ,actual );
50+ }
51+
52+ }