A fully in-memory file system useful for testing. It includes features to support writing better tests.
Use openPaths to see which paths have been opened for read or write, but not yet closed. Tests should call checkNoOpenFiles in tearDown() to confirm that no file streams were leaked.
Strict By Default
These actions are not allowed and throw an IOException if attempted:
Moving a file that is currently open for reading or writing.
Deleting a file that is currently open for reading or writing.
Moving a file to a path that currently resolves to an empty directory.
Reading and writing the same file at the same time.
Opening a file for writing that is already open for writing.
Programs that do not attempt any of the above operations should work fine on both UNIX and Windows systems. Relax these constraints individually or call emulateWindows or emulateUnix; to apply the constraints of a particular operating system.
Confirm that all files that have been opened on this file system (with source, sink, and appendingSink) have since been closed. Call this in your test's tearDown() function to confirm that your program hasn't leaked any open files.
True to allow symlinks to be created. UNIX file systems typically allow symlinks; Windows file systems do not. Setting this to false after creating a symlink does not prevent that symlink from being returned or used.