Class JctExtension
java.lang.Object
io.github.ascopes.jct.junit.JctExtension
- All Implemented Interfaces:
AfterAllCallback
,AfterEachCallback
,BeforeAllCallback
,BeforeEachCallback
,Extension
public final class JctExtension
extends Object
implements Extension, BeforeEachCallback, BeforeAllCallback, AfterEachCallback, AfterAllCallback
JUnit5 extension that will manage the lifecycle of
Managed
-annotated Workspace
fields within JUnit5 test classes.
@ExtendWith(JctExtension.class)
class MyTest {
@Managed
Workspace workspace;
@JavacCompilerTest
void myTest(JctCompiler compiler) {
// Given
workspace
.createSourcePathPackage()
...;
// When
var compilation = compiler.compile(workspace);
// Then
...
}
}
- Since:
- 0.4.0
- Author:
- Ashley Scopes
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterAll
(ExtensionContext context) void
afterEach
(ExtensionContext context) void
beforeAll
(ExtensionContext context) void
beforeEach
(ExtensionContext context)
-
Constructor Details
-
JctExtension
public JctExtension()Initialise this extension.You shouldn't ever need to call this directly. See the class description for an example of how to use this.
-
-
Method Details
-
beforeAll
- Specified by:
beforeAll
in interfaceBeforeAllCallback
- Throws:
Exception
-
beforeEach
- Specified by:
beforeEach
in interfaceBeforeEachCallback
- Throws:
Exception
-
afterAll
- Specified by:
afterAll
in interfaceAfterAllCallback
- Throws:
Exception
-
afterEach
- Specified by:
afterEach
in interfaceAfterEachCallback
- Throws:
Exception
-