Annotation Type Managed


@API(since="0.4.0", status=STABLE) @Documented @Retention(RUNTIME) @Target(FIELD) public @interface Managed
Annotation for a Workspace field in a test class. This will ensure it gets initialised and closed correctly between tests.

Use static-fields to keep a workspace object alive for the duration of all the tests (providing the same semantics as initialising and closing resources using the BeforeAll and AfterAll annotations).

You must extend your test class with the JctExtension extension for this annotation to be detected and handled.

Example usage:


 @ExtendWith(JctExtension.class)
 class MyTest {
   @Managed
   Workspace workspace;

   @JavacCompilerTest
   void myTest(JctCompiler compiler) {
     ...
     var compilation = compiler.compile(workspace);
     ...
   }
 }
 
Since:
0.4.0
Author:
Ashley Scopes