@Test public void grow() { for (int i = 0; i < 5 * IntegerStack.CHUNK_SIZE; i++) { stk.push(i); } for (int i = 5 * IntegerStack.CHUNK_SIZE - 1; i >= 0; i--) { assertEquals(i, stk.pop().intValue()); } }
@Test public void pop() { for (int i = 0; i < 100; i++) { stk.push(i); } for (int i = 99; i >= 0; i--) { assertEquals(i, stk.pop().intValue()); } }
@Test public void peek() { stk.push(1); assertEquals(1, stk.peek().intValue()); stk.push(null); assertNull(stk.peek()); stk.pop(); assertEquals(1, stk.peek().intValue()); }