 <p>If you want to create some temporary files to run tests on then you should try the JUnit Rules with <code>TemporaryFolder</code>.</p> <p><a href="http://garygregory.wordpress.com/2010/01/20/junit-tip-use-rules-to-manage-temporary-files-and-folders/" rel="nofollow">Here</a> is an example.</p> <p>That is a way to prepare your tests with necessary files.</p> <p>But it all comes down to what you actually want to do and your question is not really giving many clues...</p>