@Test public void peekTest() { // When the stack empty... try { queue.peek(); fail("A IllegalStateException should be thrown."); } catch (IllegalStateException e) { } // Adding some elements... queue.enqueue(1); queue.enqueue(2); queue.enqueue(3); assertEquals(1, queue.peek()); // Checking that this method does not remove anything. assertEquals(1, queue.peek()); }