@Test void getPermanentDirectoryWhenSetWithSystemProperty() throws Exception { Logger logger = mock(Logger.class); ReflectionUtils.setFieldValue(this.environment, "logger", logger); File expectedPermanentDirectory = new File(System.getProperty("java.io.tmpdir"), "permanent"); System.setProperty("xwiki.data.dir", expectedPermanentDirectory.toString()); try { this.environment.setServletContext(mock(ServletContext.class)); assertEquals(expectedPermanentDirectory.getCanonicalFile(), this.environment.getPermanentDirectory().getCanonicalFile()); } finally { System.clearProperty("xwiki.data.dir"); } verify(logger).info("Using permanent directory [{}]", expectedPermanentDirectory); }
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);  }