-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestQueue.java
More file actions
54 lines (35 loc) · 989 Bytes
/
TestQueue.java
File metadata and controls
54 lines (35 loc) · 989 Bytes
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
package TetsStructures;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
import Queue.Queue;
class TestQueue {
private Queue<Integer> queue;
private void stageOne() {
queue = new Queue<Integer>();
}
@Test
void testAdded() {
stageOne();
assertTrue(queue.getSize() == 0);
assertTrue(queue.isEmpty());
queue.enQueue(19);
queue.enQueue(37);
queue.enQueue(24);
queue.enQueue(51);
queue.enQueue(75);
assertFalse(queue.isEmpty());
assertTrue( queue.getFront().getValue() == 19 );
queue.deQueue();
assertTrue( queue.getFront().getValue() == 37 );
queue.deQueue();
assertTrue( queue.getFront().getValue() == 24 );
queue.deQueue();
assertTrue( queue.getFront().getValue() == 51 );
queue.deQueue();
assertTrue( queue.getFront().getValue() == 75 );
queue.deQueue();
assertTrue(queue.isEmpty());
assertTrue(queue.getSize() == 0);
}
}