ThreadLocalStack { public T popOrError() { T popped = pop(); if (popped == null) { throw new NoSuchElementException(); } return popped; }  T push(T item); T peek(); T pop(); T popOrError(); T get(); T getOrError(); void set(T item); void remove(); void with(T item, WithProcedure procedure);  }
@Test(expected = NoSuchElementException.class) public void popOrError() { assertThat(stack.popOrError(), equalTo(INITIAL_VALUE)); stack.popOrError(); }