ContextImpl implements Context { public Object getAttribute(String name) { return servletContext.getAttribute(name); } ContextImpl(ServletContext servletContext); URL getResource(String path); File getRealFile(String path); String getInitParameter(String name); @SuppressWarnings("unchecked") List<String> getResourcePaths(String path); Object getAttribute(String name); List<String> getAttributeNames(); String getMimeType(String file);  }
@Test public void get_attribute() { String name = "foo"; Object value = new Object(); ServletContext servletContext = newServletContext(); expect(servletContext.getAttribute(name)).andReturn(value); replay(); Context context = new ContextImpl(servletContext); assertSame(context.getAttribute(name), value); verify(); }