Package org.apache.sling.testing.mock.osgi.junit5

# Class OsgiConfigParametersExtension

java.lang.Object
org.apache.sling.testing.mock.osgi.junit5.OsgiConfigParametersExtension

All Implemented Interfaces:
  `org.junit.jupiter.api.extension.BeforeEachCallback`, `org.junit.jupiter.api.extension.Extension`, `org.junit.jupiter.api.extension.ParameterResolver`

public class OsgiConfigParametersExtension extends Object implements org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.BeforeEachCallback
An `Extension` which uses JUnit5 context reflection to discover OSGi Config Type Annotations present on test methods and classes, and then injects them as test parameters. For this to work for your config type annotation, you must specify `@Retention(RetentionPolicy.RUNTIME)` on the desired config type annotation class, or use `ConfigType` to declare that your config type is supported as a test parameter. This extension is also responsible for discovering `SetConfig` annotations and installing them into the `OsgiContextImpl`'s ConfigurationAdmin service.

## Constructor Summary

Constructors
Constructor
Description
`OsgiConfigParametersExtension()`

## Method Summary

Modifier and Type
Method
Description
`void`
`beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext)`
`Object`
`resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)`
`boolean`
`supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)`

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

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

## Constructor Details

### OsgiConfigParametersExtension

public OsgiConfigParametersExtension()

## Method Details

### 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`

### 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

Specified by:
  `supportsParameter` in interface `org.junit.jupiter.api.extension.ParameterResolver`
Throws:
  `org.junit.jupiter.api.extension.ParameterResolutionException`

### resolveParameter

public Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionException

Specified by:
  `resolveParameter` in interface `org.junit.jupiter.api.extension.ParameterResolver`
Throws:
  `org.junit.jupiter.api.extension.ParameterResolutionException`