Because a FileInputStream needs a real file to be
instantiated, the corresponding mock object also needs such
a file. For this reason, a KNOWN_FILE static member is
used, it is specified as C:/autoexec.bat
It is obvious that this only works on Windows, resulting in a
FileNotFound exception. If this public static member would
have been changeable, no problem, but it happens to be
A better approach is to create a temp file and make sure it
is deleted upon shutdown of the VM.
Log in to post a comment.