Class OsgiContext

  • All Implemented Interfaces:
    org.junit.rules.TestRule

    @ProviderType
    public final class OsgiContext
    extends OsgiContextImpl
    implements org.junit.rules.TestRule
    JUnit rule for setting up and tearing down OSGi context for unit tests.
    • Constructor Detail

      • OsgiContext

        public OsgiContext()
        Initialize OSGi context.
      • OsgiContext

        public OsgiContext​(@NotNull
                           @NotNull ContextCallback<T> afterSetUpCallback)
        Initialize OSGi context.
        Type Parameters:
        T - context type
        Parameters:
        afterSetUpCallback - Allows the application to register an own callback function that is called after the built-in setup rules are executed.
      • OsgiContext

        public OsgiContext​(@NotNull
                           @NotNull ContextCallback<U> afterSetUpCallback,
                           @NotNull
                           @NotNull ContextCallback<V> beforeTearDownCallback)
        Initialize OSGi context.
        Type Parameters:
        U - context type
        V - context type
        Parameters:
        afterSetUpCallback - Allows the application to register an own callback function that is called after the built-in setup rules are executed.
        beforeTearDownCallback - Allows the application to register an own callback function that is called before the built-in teardown rules are executed.
    • Method Detail

      • apply

        public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base,
                                                       org.junit.runner.Description description)
        Specified by:
        apply in interface org.junit.rules.TestRule