Code example for ArrayDeque

Methods: offer, peekFirst, peekLast

0
 
    /** 
     * @tests {@link java.util.ArrayDeque#offer(Object)} 
     */ 
    public void test_offer() throws Exception { 
        assertTrue(testQue.offer(testObjOne));
        assertTrue(testQue.offer(testObjTwo));
        assertTrue(testQue.offer(testObjOne));
        assertTrue(testQue.offer(testObjThree));
        assertEquals(testObjOne, testQue.peekFirst());
        assertEquals(testObjThree, testQue.peekLast());
        try { 
            testQue.offer(null);
            fail("Should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected 
        } 
    } 
 
    /** 
     * @tests {@link java.util.ArrayDeque#remove()}