public class TemporaryFolder extends Object
rootFolder within which any files or directories will be created along
with the operations which a tester may wish to invoke (createFile(String), createDirectory(String)) and post test invocations which the associated extension will invoke.| Modifier and Type | Method and Description |
|---|---|
File |
createDirectory(String directoryName)
Create a directory within the temporary folder root.
|
File |
createFile(String fileName)
Create a file within the temporary folder root.
|
File |
getRoot()
Returns the root folder.
|
public File getRoot()
TemporaryFolder so test cases which are used to invoking getRoot() on a JUnit4 rule
can adopt the same approach with this TemporaryFolder. In addition, this may be useful
where you want to use the root folder itself without creating files or directories within it.
Note: the extension is responsible for creating/managing/destroying the root folder so don't bother trying to clean it up yourself and don't expect that anything you do to it will survive post-test-cleanup.
public File createFile(String fileName) throws IOException
fileName - the name of the file to be createdIOException - in case the file creation call failsCopyright © 2018. All rights reserved.