i'm not sure about specific frameworks, but a general approach in terms of OOP would be to write some abstracted layers on top of any file access code (interfaces galore!) and perhaps a facade to ease use of common operations. then you just mock one layer below the code you are currently testing and it then essentially a fake file system (or at least the code you're testing won't know otherwise).
if you look into using a dependency injection framework to handle this for you it will ease the ability to switch out components for a faked implementation of an interface. if you follow the patterns of inversion of control, passing in any dependencies into the constructor of the class you are testing this will also make for easy testing.
public interface IFileSystem {
IFileHandle Load(string path);
//etc
}
public class ClassBeingTested {
public ClassBeingTested(IFileSystem fileSystem) {
//assign to private field
}
public void DoSomethingWithFileSystem() {
//utilise interface to file system here
//which you could easily mock for testing purposes
//by passing a fake implementation to the constructor
}
}
i hope my java is correct, i haven't written java in a long while, but you will hopefully get the drift. hopefully i'm not underestimating the issue here and being overly simplistic!
of course this is all assuming you mean true unit testing, that is, testing the smallest possible units of code, and not an entire system. for integration testing a different approach is needed.