Question: here is the rest of RBTTest,,.java import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions. * ; import java.util.List; / * * * RBTTest * * - - -
here is the rest of RBTTest,,.java
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.;
import java.util.List;
RBTTest
WARNING THIS TEST ASSUMES root IS PUBLIC ON THE RBT CLASS
@version
@author Daniel Wilson dancodesonline
public class RBTTest
@Test
public void testMaxHeight
RBT tree new RBT;
tree.insert;
assertEquals tree.maxHeight;
@Test
public void testMaxHeightDuplicates
RBT tree new RBT;
tree.insert;
tree.insert;
assertEquals tree.maxHeight;
@Test
public void testMaxHeight
RBT tree new RBT;
tree.insert;
tree.insert;
assertEquals tree.maxHeight;
The tree should insert like a regular tree
@Test
public void testTreeInsert
RBT rbt new RBT;
rbtinsert;
rbtinsert;
rbtinsert;
assertEqualsNodeColor.BLACK, rbtroot.getColor;
assertEqualsNodeColor.RED, rbtroot.getLeftgetColor;
assertEqualsNodeColor.RED, rbtroot.getRightgetColor;
Case : The root is always black
@Test
public void testInsertionCase
RBT rbt new RBT;
rbtinsert;
assertEqualsNodeColor.BLACK, rbtroot.getColor;
Case : Xuncle is red
@Test
public void testInsertionCaseLeft
RBT rbt new RBT;
rbtinsert;
rbtinsert;
rbtinsert;
rbtinsert;
assertEqualsNodeColor.BLACK, rbtroot.getColor;
assertEqualsNodeColor.BLACK, rbtroot.getLeftgetColor;
assertEqualsNodeColor.BLACK, rbtroot.getRightgetColor;
assertEqualsNodeColor.RED, rbtroot.getLeftgetLeftgetColor;
assertEqualsnull rbtroot.getRightgetLeft;
Case : Xuncle is red
@Test
public void testInsertionCaseRight
RBT rbt new RBT;
rbtinsert;
rbtinsert;
rbtinsert;
rbtinsert;
assertEqualsNodeColor.BLACK, rbtroot.getColor;
assertEqualsNodeColor.BLACK, rbtroot.getLeftgetColor;
assertEqualsNodeColor.BLACK, rbtroot.getRightgetColor;
assertEqualsNodeColor.RED, rbtroot.getRightgetRightgetColor;
assertEqualsnull rbtroot.getRightgetLeft;
Case : Xuncle is black triangle
Case : Xuncle is black line
@Test
public void testInsertionCaseLeft
RBT rbt new RBT;
rbtinsert;
rbtinsert;
rbtinsert;
assertEqualsNodeColor.BLACK, rbtroot.getColor;
assertEqualsNodeColor.RED, rbtroot.getLeftgetColor;
assertEqualsNodeColor.RED, rbtroot.getRightgetColor;
Case : Xuncle is black triangle
Case : Xuncle is black line
@Test
public void testInsertionCaseRight
RBT rbt new RBT;
rbtinsert;
rbtinsert;
rbtinsert;
assertEqualsNodeColor.BLACK, rbtroot.getColor;
assertEqualsNodeColor.RED, rbtroot.getLeftgetColor;
assertEqualsNodeColor.RED, rbtroot.getRightgetColor;
Test from
@Test
public void testBigTree
RBT rbt new RBT;
for int i ; i ; i
rbtinserti;
assertEqualsNodeColor.BLACK, rbtroot.getColor;
assertEqualsNodeColor.BLACK, rbtroot.getLeftgetColor;
assertEqualsNodeColor.BLACK, rbtroot.getRightgetColor;
assertEqualsNodeColor.RED, rbtroot.getLeftgetLeftgetColor;
assertEqualsNodeColor.BLACK, rbtroot.getLeftgetRightgetColor;
assertEqualsNodeColor.BLACK, rbtroot.getRightgetLeftgetColor;
assertEqualsNodeColor.BLACK, rbtroot.getRightgetRightgetColor;
assertEquals rbtroot.getData;
Test of random numbers no duplicates
@Test
public void testRandomBigTree
RBT rbt new RBT;
List nums List.of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
