EnvironmentImpl implements Environment { public <T> T pop(Class<T> type) { LinkedList<T> stack = stackFor(type); return stack.removeFirst(); }  T peek(Class<T> type); T peekRequired(Class<T> type); T pop(Class<T> type); T push(Class<T> type, T instance); void threadDidCleanup(); void cloak(); void decloak();  }
@Test public void pop_when_empty_is_error() { Environment e = new EnvironmentImpl(); try { e.pop(Runnable.class); unreachable(); } catch (NoSuchElementException ex) { } }