Class Workspaces
java.lang.Object
io.github.ascopes.jct.utils.UtilityClass
io.github.ascopes.jct.workspaces.Workspaces
Helpers to create new workspaces.
- Since:
- 0.0.1
- Author:
- Ashley Scopes
-
Method Summary
Modifier and TypeMethodDescriptionstatic Workspace
Create a new default workspace instance using the default path strategy.static Workspace
newWorkspace
(PathStrategy pathStrategy) Create a new default workspace instance using the given path strategy.
-
Method Details
-
newWorkspace
Create a new default workspace instance using the default path strategy.This workspace must be closed after use. Ideally, you should use a try-with-resources to achieve this. Failing to do this will lead to resources being leaked and tests not being cleared up correctly.
The workspace can be passed to
JctCompiler.compile(Workspace)
to run the compiler across this workspace of code.For example:
try (var workspace = Workspaces.newWorkspace()) { workspace .createSourcePathPackage() .copyContentsFrom("src", "test", "resources", "test-data"); var compilation = someCompiler.compile(workspace); assertThat(compilation).isSuccessful(); }
- Returns:
- the workspace.
-
newWorkspace
Create a new default workspace instance using the given path strategy.This workspace must be closed after use. Ideally, you should use a try-with-resources to achieve this. Failing to do this will lead to resources being leaked and tests not being cleared up correctly.
The workspace can be passed to
JctCompiler.compile(Workspace)
to run the compiler across this workspace of code.For example:
try (var workspace = Workspaces.newWorkspace(PathStrategy.TEMP_DIRECTORIES)) { workspace .createSourcePathPackage() .copyContentsFrom("src", "test", "resources", "test-data"); var compilation = someCompiler.compile(workspace); assertThat(compilation).isSuccessful(); }
- Parameters:
pathStrategy
- the path strategy to use.- Returns:
- the workspace.
-