I'm trying to test of writing files with FileSystem, provided on Jimfs.
This is a part of main code, where I'm trying to write zip-files:
Path path = Paths.get(messageFileName);
try (ZipOutputStream zos = new ZipOutputStream(Files.newOutputStream(path))) {
} catch (Exception exception) {
throw new IOException("Error writing file because by ", exception);
}
where "messageFileName" includes the full path with filename, for example:
/fullDirectoty/fileName.zip
In test code:
FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix());
Files.createDirectories(fileSystem.getPath(messageFileName);
Path pathToStore = fileSystem.getPath(messageFileName);
where "messageFileName" also contains "/fullDirectoty/fileName.zip"
But, when I run test, it fails due to NoSuchFileException
What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire