package com.fishercoder;

import com.fishercoder.common.classes.TreeNode;
import com.fishercoder.common.utils.TreeUtils;
import com.fishercoder.solutions._298;
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.Arrays;

import static org.junit.Assert.assertEquals;

public class _298Test {
    private static _298.Solution1 solution1;
    private static _298.Solution2 solution2;

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

    @Test
    public void test1() {
        TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, null, 3, 2, 4, null, null, null, 5));
        assertEquals(3, solution1.longestConsecutive(root));
        assertEquals(3, solution2.longestConsecutive(root));
    }

    @Test
    public void test2() {
        TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(2, null, 3, 2, null, 1));
        assertEquals(2, solution1.longestConsecutive(root));
        assertEquals(2, solution2.longestConsecutive(root));
    }

    @Test
    public void test3() {
        TreeNode root = TreeUtils.constructBinaryTree(Arrays.asList(1, 2, 3, null, null, 4, 4, null, 5, null, null, 6));
        TreeUtils.printBinaryTree(root);
        assertEquals(4, solution1.longestConsecutive(root));
        assertEquals(4, solution2.longestConsecutive(root));
    }

}

@@ -157,38 +157,8 @@
 98;%0A
-import org.junit.BeforeClass;%0A
 impo
@@ -373,19 +373,12 @@
    @
-BeforeClass
+Test
 %0A   
@@ -389,25 +389,18 @@
 lic 
-static void setup
+void test1
 () %7B
@@ -488,51 +488,8 @@
 ();%0A
-    %7D%0A%0A    @Test%0A    public void test1() %7B%0A
     
@@ -754,24 +754,108 @@
 d test2() %7B%0A
+        solution1 = new _298.Solution1();%0A        solution2 = new _298.Solution2();%0A
         Tree
@@ -932,24 +932,65 @@
  null, 1));%0A
+        TreeUtils.printBinaryTree(root);%0A
         asse
@@ -1138,24 +1138,108 @@
 d test3() %7B%0A
+        solution1 = new _298.Solution1();%0A        solution2 = new _298.Solution2();%0A
         Tree

fix tests for 298