Class QuarkusUnitTest

  • 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.InvocationInterceptor

    public class QuarkusUnitTest
    extends Object
    implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.InvocationInterceptor
    A test extension for testing Quarkus internals, not intended for end user consumption
    • Field Detail

      • started

        boolean started
    • Constructor Detail

      • QuarkusUnitTest

        public QuarkusUnitTest()
    • Method Detail

      • withSecuredConnection

        public static QuarkusUnitTest withSecuredConnection()
      • getArchiveProducer

        public Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive> getArchiveProducer()
      • withApplicationRoot

        public QuarkusUnitTest withApplicationRoot​(Consumer<org.jboss.shrinkwrap.api.spec.JavaArchive> applicationRootConsumer)
        Customize the application root.
        Parameters:
        applicationRootConsumer -
        Returns:
        self
      • withEmptyApplication

        public QuarkusUnitTest withEmptyApplication()
        Use an empty application for the test
        Returns:
        self
      • addAdditionalDependency

        public QuarkusUnitTest addAdditionalDependency​(org.jboss.shrinkwrap.api.spec.JavaArchive archive)
        Add the java archive as an additional dependency. This dependency is always considered an application archive, even if it would not otherwise be one.
        Parameters:
        archive -
        Returns:
        self
      • withAdditionalDependency

        public QuarkusUnitTest withAdditionalDependency​(Consumer<org.jboss.shrinkwrap.api.spec.JavaArchive> dependencyConsumer)
        Add the java archive as an additional dependency. This dependency is always considered an application archive, even if it would not otherwise be one.
        Parameters:
        dependencyConsumer -
        Returns:
        self
      • addBuildChainCustomizer

        public QuarkusUnitTest addBuildChainCustomizer​(Consumer<io.quarkus.builder.BuildChainBuilder> customizer)
      • addClassLoaderEventListener

        public QuarkusUnitTest addClassLoaderEventListener​(io.quarkus.bootstrap.classloading.ClassLoaderEventListener listener)
      • setFlatClassPath

        public QuarkusUnitTest setFlatClassPath​(boolean flatClassPath)
        If this test should use a single ClassLoader to load all the classes. This is sometimes nessesary when testing Quarkus itself, and we want the test classes and Quarkus classes to be in the same CL.
      • setForcedDependencies

        public QuarkusUnitTest setForcedDependencies​(List<io.quarkus.maven.dependency.Dependency> forcedDependencies)
        Provides a convenient way to either add additional dependencies to the application (if it doesn't already contain a dependency), or override a version (if the dependency already exists)
      • getCommandLineParameters

        public String[] getCommandLineParameters()
      • setCommandLineParameters

        public QuarkusUnitTest setCommandLineParameters​(String... commandLineParameters)
      • setAllowTestClassOutsideDeployment

        public QuarkusUnitTest setAllowTestClassOutsideDeployment​(boolean allowTestClassOutsideDeployment)
        Normally access to any test classes that are not packaged in the deployment will result in a ClassNotFoundException. If this is true then access is allowed, which can be useful when testing shutdown behaviour.
      • interceptBeforeAllMethod

        public void interceptBeforeAllMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                             org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                             org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                      throws Throwable
        Specified by:
        interceptBeforeAllMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptBeforeEachMethod

        public void interceptBeforeEachMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                              org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                              org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                       throws Throwable
        Specified by:
        interceptBeforeEachMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptAfterEachMethod

        public void interceptAfterEachMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                             org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                             org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                      throws Throwable
        Specified by:
        interceptAfterEachMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptAfterAllMethod

        public void interceptAfterAllMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                            org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                            org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                     throws Throwable
        Specified by:
        interceptAfterAllMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptTestMethod

        public void interceptTestMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                        org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                        org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                 throws Throwable
        Specified by:
        interceptTestMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptTestTemplateMethod

        public void interceptTestTemplateMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                                org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                                org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                         throws Throwable
        Specified by:
        interceptTestTemplateMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • beforeAll

        public void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                       throws Exception
        Specified by:
        beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
        Throws:
        Exception
      • afterAll

        public void afterAll​(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                      throws Exception
        Specified by:
        afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback
        Throws:
        Exception
      • afterEach

        public void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)
                       throws Exception
        Specified by:
        afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
        Throws:
        Exception
      • beforeEach

        public void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext context)
                        throws Exception
        Specified by:
        beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
        Throws:
        Exception
      • getAfterUndeployListener

        public Runnable getAfterUndeployListener()