public static Caches createCacheOnTemp(TemporaryFolder temp) { BootstrapSettings bootstrapSettings = new BootstrapSettings(new BootstrapProperties(Collections.<String, String>emptyMap())); try { bootstrapSettings .properties() .put(CoreProperties.WORKING_DIRECTORY, temp.newFolder().getAbsolutePath()); } catch (IOException e) { throw new RuntimeException(e); } return new Caches(new TempFolderProvider().provide(bootstrapSettings)); }