public void apply() {
    if (applied) {
      throw new IllegalStateException("can't apply twice");
    }
    applied = true;

    PluginFileWriteRule writeRule = new PluginFileWriteRule(
      props.nonNullValueAsFile(ProcessProperties.Property.PATH_HOME.getKey()).toPath(),
      props.nonNullValueAsFile(ProcessProperties.Property.PATH_TEMP.getKey()).toPath());
    pluginSecurityManager.restrictPlugins(writeRule);
  }
@Test
  public void fail_if_runs_twice() {
    Properties properties = new Properties();
    properties.setProperty(PATH_HOME.getKey(), "home");
    properties.setProperty(PATH_TEMP.getKey(), "temp");
    Props props = new Props(properties);
    WebSecurityManager securityManager = new WebSecurityManager(pluginSecurityManager, props);
    securityManager.apply();
    assertThrows(IllegalStateException.class, securityManager::apply);
  }