FixedSizeStack { public E pop() { if (top == 0) { throw new IllegalStateException("Stack is empty"); } final E item = (E) items[--top]; items[top] = null; return item; } FixedSizeStack(int capacity); boolean isEmpty(); void push(E item); E pop(); int getSize();  }
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "Stack is empty") public void testStackUnderflowIsNotInitiallyAllowed() throws Exception { final FixedSizeStack<Integer> stack = new FixedSizeStack<>(10); stack.pop(); }