Beispiel #1
0
 @Test
 public void testIsEmpty() {
   Queue<Integer> q = new Queue<Integer>();
   q.insert(1);
   assertFalse(q.isEmpty());
   q.remove();
   assertTrue(q.isEmpty());
 }
  @Test
  public void isEmptyTest() {
    // When the stack empty...
    assertEquals(true, queue.isEmpty());

    // Adding some elements...
    queue.enqueue(1);
    assertEquals(false, queue.isEmpty());

    // Testing it backwards...
    queue.dequeue();
    assertEquals(true, queue.isEmpty());
  }
Beispiel #3
0
 @Test
 public void testInsert() {
   Queue<Integer> q = new Queue<Integer>();
   q.insert(1);
   q.insert(2);
   assertFalse(q.isEmpty());
 }