@Test void getTemporaryDirectoryWhenNotSet() throws Exception { ServletContext servletContext = mock(ServletContext.class); when(servletContext.getAttribute("javax.servlet.context.tempdir")).thenReturn(this.servletTmpDir); this.environment.setServletContext(servletContext); File tmpDir = this.environment.getTemporaryDirectory(); assertEquals(this.servletTmpDir.listFiles()[0].getCanonicalFile(), tmpDir.getCanonicalFile()); }
public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; }
ServletEnvironment extends AbstractEnvironment { public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; } }
ServletEnvironment extends AbstractEnvironment { public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; }  }
ServletEnvironment extends AbstractEnvironment { public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; }  void setServletContext(ServletContext servletContext); ServletContext getServletContext(); @Override InputStream getResourceAsStream(String resourceName); @Override URL getResource(String resourceName); }
ServletEnvironment extends AbstractEnvironment { public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; }  void setServletContext(ServletContext servletContext); ServletContext getServletContext(); @Override InputStream getResourceAsStream(String resourceName); @Override URL getResource(String resourceName);  }