Package org.osgi.test.junit5.inject
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
ConstructorsModifierConstructorDescriptionprotectedInjectingExtension(Class<INJECTION> annotation, Class<?>... targetTypes) -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) voidafterEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) protected intprotected booleanisLifecyclePerClass(Class<?> testClass) protected booleanisLifecyclePerClass(org.junit.jupiter.api.extension.ExtensionContext context) protected ObjectresolveField(Field field, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Resolve the value for the specifiedFieldfor the specifiedExtensionContext.resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Resolve the value for the specifiedParameterContextfor the specifiedExtensionContext.protected abstract ObjectresolveValue(TargetType targetType, INJECTION injection, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Resolve the value for the specifiedTargetTypeand injection annotation for the specifiedExtensionContext.protected booleansupportsField(Field field, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Determine if this extender supports resolution for the specifiedFieldfor the specifiedExtensionContext.booleansupportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Determine if this resolver supports resolution of an argument for theParameterin the specifiedParameterContextfor the specifiedExtensionContext.protected booleansupportsType(TargetType targetType, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Determine if this extender supports resolution for the specifiedTargetTypefor the specifiedExtensionContext.
-
Constructor Details
-
InjectingExtension
-
-
Method Details
-
annotation
-
targetTypes
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception - Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback- Throws:
Exception
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception - Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback- Throws:
Exception
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception - Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Throws:
Exception
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception - Specified by:
afterEachin interfaceorg.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 specifiedFieldfor the specifiedExtensionContext. -
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 theParameterin the specifiedParameterContextfor the specifiedExtensionContext.- Specified by:
supportsParameterin interfaceorg.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 specifiedTargetTypefor the specifiedExtensionContext. 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 specifiedFieldfor the specifiedExtensionContext. -
resolveParameter
public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Resolve the value for the specifiedParameterContextfor the specifiedExtensionContext.- Specified by:
resolveParameterin interfaceorg.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 specifiedTargetTypeand injection annotation for the specifiedExtensionContext.- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
isLifecyclePerClass
protected boolean isLifecyclePerClass(org.junit.jupiter.api.extension.ExtensionContext context) -
isLifecyclePerClass
-