package com.fishercoder;

import com.fishercoder.common.classes.TreeNode;
import com.fishercoder.solutions._536;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import static junit.framework.Assert.assertEquals;

public class _536Test {
    private static _536.Solution1 solution1;
    private static _536.Solution2 solution2;
    private static TreeNode expected;
    private static TreeNode actual;
    private static String s;

    @BeforeClass
    public static void setup() {
        solution1 = new _536.Solution1();
        solution2 = new _536.Solution2();
    }

    @Before
    public void setupForEachTest() {
        expected = null;
        actual = null;
        s = "";
    }

    @Test
    public void test1() {
        s = "";
        expected = null;
        actual = solution1.str2tree(s);
        assertEquals(expected, actual);

        actual = solution2.str2tree(s);
        assertEquals(expected, actual);
    }
}

@@ -67,16 +67,63 @@
 eeNode;%0A
+import com.fishercoder.common.utils.TreeUtils;%0A
 import c
@@ -232,16 +232,42 @@
 .Test;%0A%0A
+import java.util.Arrays;%0A%0A
 import s
@@ -466,44 +466,8 @@
 ed;%0A
-    private static TreeNode actual;%0A
     
@@ -690,66 +690,270 @@
     
-    expected = null;%0A        actual = null;%0A        s = %22%22
+%7D%0A%0A    @Test%0A    public void test1() %7B%0A        s = %224(2(3)(1))(6(5))%22;%0A        expected = TreeUtils.constructBinaryTree(Arrays.asList(4, 2, 6, 3, 1, 5));%0A        assertEquals(expected, solution1.str2tree(s));%0A        assertEquals(expected, solution2.str2tree(s))
 ;%0A  
@@ -979,33 +979,33 @@
 public void test
-1
+2
 () %7B%0A        s =
@@ -1006,16 +1006,28 @@
    s = %22
+51(232)(434)
 %22;%0A     
@@ -1044,51 +1044,65 @@
 d = 
-null;%0A        actual = solution1.str2tree(s
+TreeUtils.constructBinaryTree(Arrays.asList(51, 232, 434)
 );%0A 
@@ -1134,35 +1134,8 @@
 ted,
- actual);%0A%0A        actual =
  sol
@@ -1131,33 +1131,33 @@
 pected, solution
-2
+1
 .str2tree(s);%0A  
@@ -1152,16 +1152,17 @@
 2tree(s)
+)
 ;%0A      
@@ -1190,14 +1190,29 @@
 ed, 
-actual
+solution2.str2tree(s)
 );%0A 

refactor 536