@Test void getPermanentDirectoryWhenNotSet() throws Exception { ServletContext servletContext = mock(ServletContext.class); when(servletContext.getAttribute("javax.servlet.context.tempdir")).thenReturn(this.servletTmpDir); this.environment.setServletContext(servletContext); Logger logger = mock(Logger.class); ReflectionUtils.setFieldValue(this.environment, "logger", logger); assertEquals(this.servletTmpDir.getCanonicalFile(), this.environment.getPermanentDirectory().getCanonicalFile()); verify(logger).warn("No permanent directory configured, fallbacking to temporary directory. You should set " + "the \"environment.permanentDirectory\" configuration property in the xwiki.properties file."); verify(logger).info("Using permanent directory [{}]", this.servletTmpDir.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);  }