IntegerStack { public synchronized Integer pop() { if (index >= 0) { Integer val = data[index]; index--; return val; } throw new RuntimeException("Stack is empty"); }  synchronized Integer push(Integer x); synchronized Integer pop(); synchronized Integer peek(); synchronized void clear(); int size(); static final int CHUNK_SIZE; static final int CLEAR_SIZE; }
@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()); } }