Beispiel #1
0
 @Test
 public void testInsert() {
   Queue<Integer> q = new Queue<Integer>();
   q.insert(1);
   q.insert(2);
   assertFalse(q.isEmpty());
 }
Beispiel #2
0
 @Test
 public void testIsEmpty() {
   Queue<Integer> q = new Queue<Integer>();
   q.insert(1);
   assertFalse(q.isEmpty());
   q.remove();
   assertTrue(q.isEmpty());
 }
Beispiel #3
0
 @Test
 public void testIterator() {
   Queue<Integer> q = new Queue<Integer>();
   q.insert(1);
   q.insert(2);
   Iterator<Integer> x = q.iterator();
   assertTrue(x.hasNext());
   x.next();
   assertTrue(x.hasNext());
   x.next();
   assertFalse(x.hasNext());
 }