private String createTemporaryFileStore() { try { Path path = Files.createTempDirectory("neo4jTmpEmbedded.db"); Path databasePath = Paths.get(path.toFile().getAbsolutePath() + "/database"); Files.createDirectories(databasePath); final File f = databasePath.toFile(); URI uri = f.toURI(); final String databaseUriValue = uri.toString(); logger.warn("Creating temporary file store: " + databaseUriValue); Runtime.getRuntime().addShutdownHook(new Thread(() -> { close(); try { logger.warn("Deleting temporary file store: " + databaseUriValue); deleteDirectory(path); } catch (IOException e) { throw new RuntimeException("Failed to delete temporary files in " + databaseUriValue, e); } })); return databaseUriValue; } catch (Exception e) { throw new RuntimeException(e); } }