@Test(expected = IllegalStateException.class) public void fullStack() { for (int i = 0; i < MAX_CAPACITY + 1; i++) { toTest.push("X"); } }
@Override public void push(final DATA value) { if (top == storage.length - 1) { throw new IllegalStateException("Stack overflow."); } storage[++top] = value; }
ArrayStack implements Stack<DATA> { @Override public void push(final DATA value) { if (top == storage.length - 1) { throw new IllegalStateException("Stack overflow."); } storage[++top] = value; } }
ArrayStack implements Stack<DATA> { @Override public void push(final DATA value) { if (top == storage.length - 1) { throw new IllegalStateException("Stack overflow."); } storage[++top] = value; } ArrayStack(final int capacity); }
ArrayStack implements Stack<DATA> { @Override public void push(final DATA value) { if (top == storage.length - 1) { throw new IllegalStateException("Stack overflow."); } storage[++top] = value; } ArrayStack(final int capacity); @Override void push(final DATA value); @Override DATA pop(); @Override boolean isEmpty(); }
ArrayStack implements Stack<DATA> { @Override public void push(final DATA value) { if (top == storage.length - 1) { throw new IllegalStateException("Stack overflow."); } storage[++top] = value; } ArrayStack(final int capacity); @Override void push(final DATA value); @Override DATA pop(); @Override boolean isEmpty();  }