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

# Class OsgiContextBuilder

java.lang.Object
org.apache.sling.testing.mock.osgi.junit.OsgiContextBuilder

@ProviderType public final class OsgiContextBuilder extends Object
Builder class for creating `OsgiContext` instances with different sets of parameters.

## Constructor Summary

Constructors
Constructor
Description
`OsgiContextBuilder()`
Create builder.

## Method Summary

Modifier and Type
Method
Description
`final @NotNull OsgiContextBuilder`
`afterSetUp(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... afterSetUpCallback)`
`final @NotNull OsgiContextBuilder`
`afterTearDown(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... afterTearDownCallback)`
`final @NotNull OsgiContextBuilder`
`beforeSetUp(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... beforeSetUpCallback)`
`final @NotNull OsgiContextBuilder`
`beforeTearDown(@NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... beforeTearDownCallback)`
`@NotNull OsgiContext`
`build()`
`final @NotNull OsgiContextBuilder`
`plugin(@NotNull org.apache.sling.testing.mock.osgi.context.ContextPlugin<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... plugin)`

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

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

## Constructor Details

### OsgiContextBuilder

public OsgiContextBuilder()
Create builder.

## Method Details

### plugin

@SafeVarargs @NotNull public final @NotNull OsgiContextBuilder plugin(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextPlugin<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... plugin)

Parameters:
  `plugin` - Context plugin which listens to context lifecycle events.
Returns:
  this

### beforeSetUp

@SafeVarargs @NotNull public final @NotNull OsgiContextBuilder beforeSetUp(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... beforeSetUpCallback)

Parameters:
  `beforeSetUpCallback` - Allows the application to register an own callback function that is called before the built-in setup rules are executed.
Returns:
  this

### afterSetUp

@SafeVarargs @NotNull public final @NotNull OsgiContextBuilder afterSetUp(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... afterSetUpCallback)

Parameters:
  `afterSetUpCallback` - Allows the application to register an own callback function that is called after the built-in setup rules are executed.
Returns:
  this

### beforeTearDown

@SafeVarargs @NotNull public final @NotNull OsgiContextBuilder beforeTearDown(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... beforeTearDownCallback)

Parameters:
  `beforeTearDownCallback` - Allows the application to register an own callback function that is called before the built-in teardown rules are executed.
Returns:
  this

### afterTearDown

@SafeVarargs @NotNull public final @NotNull OsgiContextBuilder afterTearDown(@NotNull @NotNull org.apache.sling.testing.mock.osgi.context.ContextCallback<? extends org.apache.sling.testing.mock.osgi.context.OsgiContextImpl> @NotNull ... afterTearDownCallback)

Parameters:
  `afterTearDownCallback` - Allows the application to register an own callback function that is after before the built-in teardown rules are executed.
Returns:
  this

### build

@NotNull public @NotNull OsgiContext build()

Returns:
  Build `OsgiContext` instance.