package com.fishercoder;

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

import static junit.framework.Assert.assertEquals;

public class _538Test {
    private static _538.Solution2 solution2;
    private static _538.Solution1 solution1;
    private static TreeNode expectedRoot;
    private static TreeNode root;

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

    @Before
    public void setupForEachTest() {
    }

    @Test
    public void test1() {
        root = new TreeNode(5);
        root.left = new TreeNode(2);
        root.right = new TreeNode(13);
        expectedRoot = new TreeNode(18);
        expectedRoot.left = new TreeNode(20);
        expectedRoot.right = new TreeNode(13);
        assertEquals(expectedRoot.toString(), solution2.convertBST(root).toString());
        assertEquals(expectedRoot.toString(), solution1.convertBST(root).toString());
    }

    @Test
    public void test2() {
        root = null;
        expectedRoot = null;
        assertEquals(expectedRoot, solution2.convertBST(root));
        assertEquals(expectedRoot, solution1.convertBST(root));
    }
}

@@ -293,17 +293,17 @@
 Solution
-2
+1
  solutio
@@ -303,17 +303,17 @@
 solution
-2
+1
 ;%0A    pr
@@ -330,33 +330,33 @@
 ic _538.Solution
-1
+2
  solution1;%0A    
@@ -340,33 +340,33 @@
 lution2 solution
-1
+2
 ;%0A    private st
@@ -573,64 +573,8 @@
  %7D%0A%0A
-    @Before%0A    public void setupForEachTest() %7B%0A    %7D%0A%0A
     
@@ -893,33 +893,33 @@
 ring(), solution
-2
+1
 .convertBST(root
@@ -979,33 +979,33 @@
 ring(), solution
-1
+2
 .convertBST(root
@@ -1147,33 +1147,33 @@
 edRoot, solution
-2
+1
 .convertBST(root
@@ -1211,33 +1211,33 @@
 edRoot, solution
-1
+2
 .convertBST(root

refactor 538 test