Make it throw!
Open
P4
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 296
- Avg merge
- 9m
- Merged PRs (30d)
- 7
Description
I always find it difficult to test I/O error handling. Jimfs immensely simplifies writing unit tests for code that interacts with the file system, but it doesn't help with testing the 'bad' path.
I would like to be able to set expectations on a `Path`, e.g. to throw an `IOException` if someone tries to open a channel for it. I was thinking of a new method `Jimfs.newMockFileSystem()` that returns a specialized `MockFileSystem`, which in turn can be used to build `Path` objects that behave how I want.
As I understand it, the goal of Jimfs is to simplify unit testing, so I hope this feature request is not too much out of scope?!
Contributor guide
Assessment
This issue has not been assessed yet.