Package org.osgi.test.junit5.context
Class BundleInstallerExtension
java.lang.Object
org.osgi.test.junit5.inject.InjectingExtension<InjectBundleInstaller>
org.osgi.test.junit5.context.BundleInstallerExtension
- 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
A JUnit 5 Extension to get a
BundleInstaller for the test bundle.
The BundleContext implementation used by this extension will
automatically clean up all service registrations, bundle, service and
framework listeners, as well as installed bundles left behind.
Example:
@ExtendWith(BundleInstallerExtension.class)
class MyTests {
@InjectBundleInstaller
BundleInstaller bundleInstaller;
@Test
public void aTest() {
// use bundleInstaller
}
}
- Since:
- 1.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BundleInstallergetBundleInstaller(org.junit.jupiter.api.extension.ExtensionContext extensionContext) protected ObjectresolveValue(TargetType targetType, InjectBundleInstaller injection, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Resolve the value for the specifiedTargetTypeand injection annotation for the specifiedExtensionContext.Methods inherited from class org.osgi.test.junit5.inject.InjectingExtension
afterAll, afterEach, annotation, beforeAll, beforeEach, disallowedFieldModifiers, isLifecyclePerClass, isLifecyclePerClass, resolveField, resolveParameter, supportsField, supportsParameter, supportsType, targetTypes
-
Field Details
-
INSTALL_BUNDLE_KEY
- See Also:
-
-
Constructor Details
-
BundleInstallerExtension
public BundleInstallerExtension()
-
-
Method Details
-
getBundleInstaller
public static BundleInstaller getBundleInstaller(org.junit.jupiter.api.extension.ExtensionContext extensionContext) -
resolveValue
protected Object resolveValue(TargetType targetType, InjectBundleInstaller injection, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException Description copied from class:InjectingExtensionResolve the value for the specifiedTargetTypeand injection annotation for the specifiedExtensionContext.- Specified by:
resolveValuein classInjectingExtension<InjectBundleInstaller>- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-