Class ForkedJvmExtension

java.lang.Object
groovy.junit6.plugin.ForkedJvmExtension
All Implemented Interfaces:
Extension, InvocationInterceptor, TestInstantiationAwareExtension

public class ForkedJvmExtension extends Object implements InvocationInterceptor
JUnit 5 InvocationInterceptor backing the ForkedJvm annotation. When applied, the test method is skipped in the current JVM and re-run in a freshly forked JVM via ForkedJvmTestRunner, with any declared system properties and JVM args.

Recursion is avoided by setting the system property ForkedJvmTestRunner.FORKED_FLAG on the child; when the extension sees that flag set in the current JVM it just proceeds with the normal invocation (i.e. the child JVM actually runs the test body).

Since:
6.0.0