package com.fishercoder;

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static org.junit.Assert.assertEquals;

public class _145Test {
    private static _145 test;
    private static TreeNode root;
    private static List<Integer> expected;

    @BeforeClass
    public static void setup() {
        test = new _145();
    }

    @Test
    public void test1() {
        root = new TreeNode(1);
        root.left = new TreeNode(2);
        root.right = new TreeNode(3);
        expected = new ArrayList<>(Arrays.asList(2, 3, 1));
        assertEquals(expected, test.postorderTraversal_recursive(root));
    }
}

@@ -307,18 +307,16 @@
 5Test %7B%0A
-  
   privat
@@ -332,17 +332,73 @@
 _145
- 
+.Solution1 solution1;%0A  priva
 te
+ 
 st
+atic _145.Solution2 solution2
 ;%0A
-  
   pr
@@ -425,18 +425,16 @@
 e root;%0A
-  
   privat
@@ -467,18 +467,16 @@
 ected;%0A%0A
-  
   @Befor
@@ -482,18 +482,16 @@
 reClass%0A
-  
   public
@@ -521,16 +521,55 @@
     
-    test
+solution1 = new _145.Solution1();%0A    solution2
  = n
@@ -579,29 +579,35 @@
 _145
+.Solution2
 ();%0A
-  
   %7D%0A%0A
-  
   @Test%0A
     
@@ -602,18 +602,16 @@
   @Test%0A
-  
   public
@@ -626,28 +626,24 @@
 st1() %7B%0A    
-   
- 
 root = new T
@@ -654,20 +654,16 @@
 ode(1);%0A
-    
     root
@@ -691,20 +691,16 @@
 2);%0A    
-  
-  
 root.rig
@@ -721,20 +721,16 @@
 ode(3);%0A
-    
     expe
@@ -781,20 +781,16 @@
 ));%0A    
- 
-   
 assertEq
@@ -804,20 +804,25 @@
 pected, 
-test
+solution1
 .postord
@@ -836,18 +836,72 @@
 rsal
-_recursive
+(root));%0A    assertEquals(expected, solution2.postorderTraversal
 (roo
@@ -905,16 +905,14 @@
 root));%0A
-  
   %7D%0A%7D%0A

refactor 145