public static TemporaryFolder temp = new TemporaryFolder();
public static Caches createCacheOnTemp(TemporaryFolder temp) {
BootstrapProperties 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));
}