EnvironmentImpl implements Environment { public <T> T peek(Class<T> type) { LinkedList<T> stack = stackFor(type); return stack.isEmpty() ? null : stack.getFirst(); }  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 peek_when_empty_returns_null() { Environment e = new EnvironmentImpl(); assertNull(e.peek(Runnable.class)); assertNull(e.peek(Map.class)); }