-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBInternalNodeTest.java
More file actions
73 lines (66 loc) · 1.57 KB
/
BInternalNodeTest.java
File metadata and controls
73 lines (66 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import student.TestCase;
/**
* This class tests the methods in the BInternalNode class.
*
* @author karl88
* @author sfbahr
* @version Oct 18, 2014
*/
public class BInternalNodeTest extends TestCase
{
private BInternalNode node;
private KVPair pair1;
private KVPair pair2;
private BNode left;
private BNode center;
private BNode right;
/**
* This sets up the test class.
*/
public void setUp()
{
node = new BInternalNode(pair1, pair2, left,
center, right, false);
}
/**
* This tests the isLeaf() method.
*/
public void testIsLeaf()
{
assertFalse(node.isLeaf());
}
/**
* This tests the getLeftChild() and setLeftChild() methods.
*/
public void testGetLeftChild()
{
node.setLeftChild(left);
assertEquals(left, node.getLeftChild());
}
/**
* This tests the getMiddleChild() and setMiddleChild() methods.
*/
public void testGetMiddleChild()
{
node.setMiddleChild(left);
assertEquals(center, node.getMiddleChild());
}
/**
* This tests the getRightChild() and setRightChild() methods.
*/
public void testGetRightChild()
{
node.setRightChild(left);
assertEquals(right, node.getRightChild());
}
/**
* This tests the isPromoted() and setIsPromoted() methods.
*/
public void testIsPromoted()
{
node.setIsPromoted(true);
assertTrue(node.isPromoted());
node.setIsPromoted(false);
assertFalse(node.isPromoted());
}
}