Class InjectingExtension<INJECTION extends Annotation>

java.lang.Object
org.osgi.test.junit5.inject.InjectingExtension<INJECTION>
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.ParameterResolver
Direct Known Subclasses:
BundleContextExtension, BundleInstallerExtension, InstalledBundleExtension, ServiceExtension

public abstract class InjectingExtension<INJECTION extends Annotation> extends Object implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.AfterEachCallback
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    InjectingExtension(Class<INJECTION> annotation, Class<?>... targetTypes)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
     
    void
    afterEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
     
    protected Class<INJECTION>
     
    void
    beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
     
    void
    beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
     
    protected int
     
    protected boolean
    isLifecyclePerClass(Class<?> testClass)
     
    protected boolean
    isLifecyclePerClass(org.junit.jupiter.api.extension.ExtensionContext context)
     
    protected Object
    resolveField(Field field, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
    Resolve the value for the specified Field for the specified ExtensionContext.
    resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
    Resolve the value for the specified ParameterContext for the specified ExtensionContext.
    protected abstract Object
    resolveValue(TargetType targetType, INJECTION injection, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
    Resolve the value for the specified TargetType and injection annotation for the specified ExtensionContext.
    protected boolean
    supportsField(Field field, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
    Determine if this extender supports resolution for the specified Field for the specified ExtensionContext.
    boolean
    supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
    Determine if this resolver supports resolution of an argument for the Parameter in the specified ParameterContext for the specified ExtensionContext.
    protected boolean
    supportsType(TargetType targetType, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
    Determine if this extender supports resolution for the specified TargetType for the specified ExtensionContext.
    protected List<Class<?>>
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InjectingExtension

      protected InjectingExtension(Class<INJECTION> annotation, Class<?>... targetTypes)
  • Method Details

    • annotation

      protected Class<INJECTION> annotation()
    • targetTypes

      protected List<Class<?>> targetTypes()
    • beforeAll

      public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception
      Specified by:
      beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
      Throws:
      Exception
    • afterAll

      public void afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception
      Specified by:
      afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback
      Throws:
      Exception
    • beforeEach

      public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception
      Specified by:
      beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
      Throws:
      Exception
    • afterEach

      public void afterEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception
      Specified by:
      afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
      Throws:
      Exception
    • disallowedFieldModifiers

      protected int disallowedFieldModifiers()
    • supportsField

      protected boolean supportsField(Field field, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
      Determine if this extender supports resolution for the specified Field for the specified ExtensionContext.
    • supportsParameter

      public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
      Determine if this resolver supports resolution of an argument for the Parameter in the specified ParameterContext for the specified ExtensionContext.
      Specified by:
      supportsParameter in interface org.junit.jupiter.api.extension.ParameterResolver
      Throws:
      org.junit.jupiter.api.extension.ParameterResolutionException
    • supportsType

      protected boolean supportsType(TargetType targetType, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
      Determine if this extender supports resolution for the specified TargetType for the specified ExtensionContext. The default implementation checks through all of the types that were passed to the constructor.
      Throws:
      org.junit.jupiter.api.extension.ParameterResolutionException
    • resolveField

      protected Object resolveField(Field field, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
      Resolve the value for the specified Field for the specified ExtensionContext.
    • resolveParameter

      public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
      Resolve the value for the specified ParameterContext for the specified ExtensionContext.
      Specified by:
      resolveParameter in interface org.junit.jupiter.api.extension.ParameterResolver
    • resolveValue

      protected abstract Object resolveValue(TargetType targetType, INJECTION injection, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException
      Resolve the value for the specified TargetType and injection annotation for the specified ExtensionContext.
      Throws:
      org.junit.jupiter.api.extension.ParameterResolutionException
    • isLifecyclePerClass

      protected boolean isLifecyclePerClass(org.junit.jupiter.api.extension.ExtensionContext context)
    • isLifecyclePerClass

      protected boolean isLifecyclePerClass(Class<?> testClass)