@Test public void get_real_file_exists() throws IOException { String path = "/foo.gif"; File file = File.createTempFile("foo", "gif"); String realPath = file.getPath(); ServletContext servletContext = newServletContext(); train_getRealPath(servletContext, path, realPath); replay(); Context c = new ContextImpl(servletContext); File f = c.getRealFile(path); assertEquals(f, file); verify(); }
public File getRealFile(String path) { String realPath = servletContext.getRealPath(path); return realPath == null ? null : new File(realPath); }
ContextImpl implements Context { public File getRealFile(String path) { String realPath = servletContext.getRealPath(path); return realPath == null ? null : new File(realPath); } }
ContextImpl implements Context { public File getRealFile(String path) { String realPath = servletContext.getRealPath(path); return realPath == null ? null : new File(realPath); } ContextImpl(ServletContext servletContext); }
ContextImpl implements Context { public File getRealFile(String path) { String realPath = servletContext.getRealPath(path); return realPath == null ? null : new File(realPath); } 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); }
ContextImpl implements Context { public File getRealFile(String path) { String realPath = servletContext.getRealPath(path); return realPath == null ? null : new File(realPath); } 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);  }