Class TestCaseInvocationContextProvider

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider

    @Internal
    public class TestCaseInvocationContextProvider
    extends Object
    implements org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
    A helper class for injecting test resources into test case as parameters.

    This provider will resolve TestEnvironment and ExternalContextFactory from the storage in JUnit's ExtensionContext, inject them into test method, and register a AfterTestExecutionCallback for closing the external context after the execution of test case.

    • Constructor Detail

      • TestCaseInvocationContextProvider

        public TestCaseInvocationContextProvider()
    • Method Detail

      • supportsTestTemplate

        public boolean supportsTestTemplate​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        supportsTestTemplate in interface org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider
      • provideTestTemplateInvocationContexts

        public Stream<org.junit.jupiter.api.extension.TestTemplateInvocationContext> provideTestTemplateInvocationContexts​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        provideTestTemplateInvocationContexts in interface org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider