Package io.helidon.common.testing.junit5
Class TemporaryFolderExt
java.lang.Object
io.helidon.common.testing.junit5.TemporaryFolderExt
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension
@Deprecated(since="4.5.0",
forRemoval=true)
public class TemporaryFolderExt
extends Object
implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
Deprecated, for removal: This API element is subject to removal in a future version.
JUnit 5 extension for temporary folder operations.
Declare the extension in a test using
@RegisterExtension
static TemporaryFolderExt folder = TemporaryFolderExt.build();
The static is important.
When a test needs a temporary folder it invokes folder.newFolder().
The extension automatically deletes the temporary files after all tests in the test class have finished.
-
Method Summary
Modifier and TypeMethodDescriptionvoidafterEach(org.junit.jupiter.api.extension.ExtensionContext ec) Deprecated, for removal: This API element is subject to removal in a future version.voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext ec) Deprecated, for removal: This API element is subject to removal in a future version.static TemporaryFolderExtbuild()Deprecated, for removal: This API element is subject to removal in a future version.Builds an instance ofTemporaryFolderExt.getRoot()Deprecated, for removal: This API element is subject to removal in a future version.The root for this test's temporary files.newFile()Deprecated, for removal: This API element is subject to removal in a future version.Creates a new temporary file with a generated unique name.Deprecated, for removal: This API element is subject to removal in a future version.Creates a new temporary file with the specified name.Deprecated, for removal: This API element is subject to removal in a future version.Creates a new temporary folder with a unique generated name.Deprecated, for removal: This API element is subject to removal in a future version.Creates a new temporary folder with the specified name.
-
Method Details
-
build
Deprecated, for removal: This API element is subject to removal in a future version.Builds an instance ofTemporaryFolderExt.- Returns:
- a TemporaryFolderExt
-
newFolder
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new temporary folder with a unique generated name.- Returns:
- File for the newly-created temporary folder
- Throws:
IOException- in case of error creating the new folder
-
newFolder
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new temporary folder with the specified name.- Parameters:
name- of the folder to create- Returns:
- File for the new folder
- Throws:
IOException- in case of error creating the new folder
-
newFile
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new temporary file with a generated unique name.- Returns:
- the new File
- Throws:
IOException- in case of error creating the new file
-
newFile
Deprecated, for removal: This API element is subject to removal in a future version.Creates a new temporary file with the specified name.- Parameters:
name- name to be used for the new file- Returns:
- File for the newly-created file
- Throws:
IOException- in case of error creating the new file
-
getRoot
Deprecated, for removal: This API element is subject to removal in a future version.The root for this test's temporary files.- Returns:
- the root File
-
beforeEach
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Throws:
Exception
-
afterEach
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback- Throws:
Exception
-
@TempDirsupport for temporary files and directories instead.