I am running into problems on my (Linux) Jenkins server when using the Java Files API.
An integration test is failing, which uses a JUnit TemporaryFolder
. The test executes the following code:
Path expectedPath = tmpFolder.getRoot().toPath().resolve("folder1/folder2");
// create files
assertTrue(Files.exists(expectedPath.resolve("newFile1.txt")));
The test passes locally, and I see in the logs for the Jenkins run that expectedPath
is being created successfully, but what confuses me is the "path" to my new file:
/tmp/junit0219318729037123/folder1\/folder2/newFile1.txt
Why has \/
been introduced? Is this some quirk of Files on Linux, or a problem with my tmpFolder
?
newFile1.txt
is in a folder namedfolder1/folder2
and not in thefolder2
(which is infolder1
)Files.createDirectories
to create folder1 and folder2, I then useFiles.write(myFilePath, someBytes, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE
.