Hi Guys I am testing a thing in my project and I am really confuse about a little thing, I didnt too much in mac, basically always in windows, and recently i was testing a thing with generative files. This thing check if a directory with the assertion of Junit, idk why when i pass a tmp directory generated by an annotation by Junit this make a temporary directory, thats works as expected, the problem comes, when the temporary directory is empty, and (I think) mac say "Oh this path with not extensions and no content its a file and obviously not is a directory" I am loosing my mind because i didnt found nothing on internet. Someone have the same problem at some point?
#Mac And Files In Java
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
@elder flame can u post the code ? quite hard to have any idea on what's going on without that
Mmm yes, give me a second
And if you give me a few mins i will put the codee without image
final Path pathToTarget = Path.of(resultPath.toString(), "target");
final Path pathToTargetConsumer = pathToTarget.resolve(targetConsumer);
final File targetConsumerFolder = pathToTargetConsumer.toFile();
assertThat(targetConsumerFolder).isNotEmptyDirectory();```
Detected code, here are some useful tools:
Formatted code
// some code
final Path pathToTarget = Path.of(resultPath.toString(), "target");
final Path pathToTargetConsumer = pathToTarget.resolve(targetConsumer);
final File targetConsumerFolder = pathToTargetConsumer.toFile();
assertThat(targetConsumerFolder).isNotEmptyDirectory();
The error:
Error: AsyncApiGeneratorTest.processFileSpecForTestFileGeneration:73
Expecting file:
/tmp/junit7678323192558060198/target/generated
to be an existing directory.```
Detected code, here are some useful tools:
Formatted code
Error : AsyncApiGeneratorTest.processFileSpecForTestFileGeneration : 73Expecting file : / tmp / junit7678323192558060198 / target / generated to be an existing directory.
don't use legacy IO classes
if there is no API for Path objects, use assertTrue with Files.isDirectory
The problem its Files.isDirectory keep saying a specific directory not is one
For that i want know how Java determine if its a directory or nnot
could you say that again please