public class FileSystemFixtureSupport extends Object
createDirectory()
or load pre-built zip archives of directory structures into the temporary directory. In your test's
@Before method, you can cleanup the files/directories created during the test through the
teardown() method. You can also delete the temporary directory by calling the
destroy() method from an @AfterClass method. Once this is called, the fixture support
cannot be used.| Constructor and Description |
|---|
FileSystemFixtureSupport(File rootDir)
Create a FileSystemFixtureSupport that will manage the specified File as its temporary root directory.
|
FileSystemFixtureSupport(String prefix)
Create a FileSystemFixtureSupport that will create a new temporary directory using the specified
name prefix.
|
| Modifier and Type | Method and Description |
|---|---|
File |
createDirectory(String path)
Creates a new directory that is relative to the temporary testing root.
|
void |
destroy()
Deletes all of the fixture files as well as the temporary root directory.
|
File |
getTestingRoot() |
void |
loadFileFixtures(List<String> resourcesToLoad)
Loads a directory structure from a zip archive.
|
void |
teardown()
Deletes any directories or files that have been created by this class.
|
public FileSystemFixtureSupport(String prefix)
prefix - the prefix used when naming the temporary directory this will managepublic FileSystemFixtureSupport(File rootDir)
rootDir - the temporary root directory. This will be created if it does not already exist.public File createDirectory(String path)
path - the relative path of the new directory.public void loadFileFixtures(List<String> resourcesToLoad) throws IOException
resourcesToLoad - the names of zip archives in the classpath that should be loaded.IOException - if we cannot unarchive the filespublic void teardown()
throws IOException
IOException - if we are unable to delete the datapublic void destroy()
throws IOException
IOException - if deletion failspublic File getTestingRoot()
Copyright © 2014. All Rights Reserved.