package com.matao;

/**
 * Created by matao on 2018-12-10.
 */
public class Q08_NextNodeInBinaryTreesTest {
}

@@ -17,94 +17,2427 @@
 o;%0A%0A
-/**%0A * Created by matao on 2018-12-10.%0A */%0Apublic class Q08_NextNodeInBinaryTreesTest %7B
+import com.matao.common.TreeNodeWithParent;%0Aimport org.junit.jupiter.api.Assertions;%0Aimport org.junit.jupiter.api.BeforeEach;%0Aimport org.junit.jupiter.api.Test;%0A%0A/**%0A * Created by matao on 2018-12-10.%0A */%0Apublic class Q08_NextNodeInBinaryTreesTest %7B%0A%0A    private Q08_NextNodeInBinaryTrees nextNodeInBinaryTrees;%0A    private TreeNodeWithParent%3CInteger%3E root;%0A    private TreeNodeWithParent%3CInteger%3E node2;%0A    private TreeNodeWithParent%3CInteger%3E node3;%0A    private TreeNodeWithParent%3CInteger%3E node4;%0A    private TreeNodeWithParent%3CInteger%3E node5;%0A    private TreeNodeWithParent%3CInteger%3E node6;%0A    private TreeNodeWithParent%3CInteger%3E node7;%0A    private TreeNodeWithParent%3CInteger%3E node8;%0A    private TreeNodeWithParent%3CInteger%3E node9;%0A%0A    /**%0A     * %3Cpre%3E%0A     *                  1%0A     *               //   %5C%5C%0A     *              2       3%0A     *            // %5C%5C    // %5C%5C%0A     *           4     5  6    7%0A     *              // %5C%5C%0A     *              8   9%0A     *%0A     *       inorder : 4 2 8 5 9 1 6 3 7%0A     * %3C/pre%3E%0A     */%0A    @BeforeEach%0A    void setUp() %7B%0A        nextNodeInBinaryTrees = new Q08_NextNodeInBinaryTrees();%0A        root = new TreeNodeWithParent%3C%3E(1);%0A        node2 = new TreeNodeWithParent%3C%3E(2);%0A        node3 = new TreeNodeWithParent%3C%3E(3);%0A        node4 = new TreeNodeWithParent%3C%3E(4);%0A        node5 = new TreeNodeWithParent%3C%3E(5);%0A        node6 = new TreeNodeWithParent%3C%3E(6);%0A        node7 = new TreeNodeWithParent%3C%3E(7);%0A        node8 = new TreeNodeWithParent%3C%3E(8);%0A        node9 = new TreeNodeWithParent%3C%3E(9);%0A%0A        root.left = node2;%0A        root.right = node3;%0A        node2.left = node4;%0A        node2.right = node5;%0A        node5.left = node8;%0A        node5.right = node9;%0A        node3.left = node6;%0A        node3.right = node7;%0A%0A        node4.parent = node2;%0A        node2.parent = root;%0A        node8.parent = node5;%0A        node9.parent = node5;%0A        node5.parent = node2;%0A        node6.parent = node3;%0A        node7.parent = node3;%0A        node3.parent = root;%0A    %7D%0A%0A    @Test%0A    void test() %7B%0A        Assertions.assertEquals(node9, nextNodeInBinaryTrees.getNext(node5));%0A        Assertions.assertEquals(node2, nextNodeInBinaryTrees.getNext(node4));%0A        Assertions.assertEquals(node5, nextNodeInBinaryTrees.getNext(node8));%0A        Assertions.assertEquals(root, nextNodeInBinaryTrees.getNext(node9));%0A        Assertions.assertNull(nextNodeInBinaryTrees.getNext(node7));%0A    %7D%0A
 %0A%7D%0A

add test case for NextNodeInBinaryTrees