private TestInstance.Lifecycle determineTestLifecycle(ExtensionContext ec) { // check the test for import org.junit.jupiter.api.TestInstance annotation TestInstance annotation = ec.getRequiredTestClass().getAnnotation(TestInstance.class); if (annotation != null) { return annotation.value(); } else { return TestInstance.Lifecycle.PER_METHOD; } }