JavaHamcrest icon indicating copy to clipboard operation
JavaHamcrest copied to clipboard

Create PathMatchers class - Like FileMatchers but for java.nio.Path

Open rmcdouga opened this issue 5 months ago • 0 comments

While not deprecated, the java.io.File class has been superceded by the java.nio.Path/java.nio.Files classes. I think more modern code would like to perform tests on Paths without having to convert them to File objects, so I think there's a need for a PathMatchers class in the io package.

I'd like to create a PR with just such a class. I just want to check that there are no objections before performing that work.

I was going to use FileMatchers class as the starting point (so all the FileMatchers methods will have corresponding Path methods making for easy transition), however I have reconsidered this and decided to create methods that more closely match the existing Path methods (e.g. hasRealPath() instead of hasCanonicalPath()). I think this approach will make the API easier to inuit in the longer term.

rmcdouga avatar Aug 13 '25 13:08 rmcdouga