Queue { public boolean isFull() { int nextTailValue = tail; if (nextTailValue == queue.length - 1) { nextTailValue = 0; } else { nextTailValue++; } if (head == nextTailValue) { return true; } else { return false; } } Queue();  Queue(int queueSize); void enqueue(Object element); Object dequeue(); boolean isEmpty(); boolean isFull();  }
@Test public void testIsFull() throws QueueOverflowException { Queue queue = new Queue(); for (int i = 0; i < 8; i++) { queue.enqueue(i); } Assert.assertFalse(queue.isFull()); queue.enqueue(9); Assert.assertTrue(queue.isFull()); queue.dequeue(); Assert.assertFalse(queue.isFull()); queue.enqueue(10); Assert.assertTrue(queue.isFull()); }