Package groovy.junit6.plugin

# Class ExpectedToFailExtension

java.lang.Object
groovy.junit6.plugin.ExpectedToFailExtension

All Implemented Interfaces:
  `Extension`, `InvocationInterceptor`, `TestInstantiationAwareExtension`

public class ExpectedToFailExtension extends Object implements InvocationInterceptor
JUnit 5 `InvocationInterceptor` backing the `ExpectedToFail` annotation. Inverts a test's pass/fail outcome with optional exception-type and message-substring filters.

Composes with `ForkedJvm` in either declaration order via explicit coordination through `ExtensionContext.Store` and a child-JVM system property — not via brittle reliance on annotation iteration order.

Since:
  6.0.0

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor

  `InvocationInterceptor.Invocation<T extends Object>`

  ## Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension

  `TestInstantiationAwareExtension.ExtensionContextScope`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DEFERRED_TO_PARENT_PROP`
  System property set on the child JVM's command line by `ForkedJvmExtension` when the parent's `@ExpectedToFail` has claimed the inversion.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExpectedToFailExtension()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `interceptTestMethod(InvocationInterceptor.Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor

  `interceptAfterAllMethod, interceptAfterEachMethod, interceptBeforeAllMethod, interceptBeforeEachMethod, interceptDynamicTest, interceptTestClassConstructor, interceptTestFactoryMethod, interceptTestTemplateMethod`

  ### Methods inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension

  `getTestInstantiationExtensionContextScope`

- ## Field Details

  - ### DEFERRED_TO_PARENT_PROP

    public static final String DEFERRED_TO_PARENT_PROP
    System property set on the child JVM's command line by `ForkedJvmExtension` when the parent's `@ExpectedToFail` has claimed the inversion. The child's `@ExpectedToFail` interceptor checks this property and passes through honestly so the parent can observe the propagated outcome.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ExpectedToFailExtension

    public ExpectedToFailExtension()

- ## Method Details

  - ### interceptTestMethod

    public void interceptTestMethod(InvocationInterceptor.Invocation<Void> invocation, ReflectiveInvocationContext<Method> invocationContext, ExtensionContext extensionContext) throws Throwable
    Specified by:
      `interceptTestMethod` in interface `InvocationInterceptor`
    Throws:
      `Throwable`