Package io.quarkus.test
Class QuarkusUnitTest
- java.lang.Object
-
- io.quarkus.test.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) booleanstartedstatic StringTHE_BUILD_WAS_EXPECTED_TO_FAIL
-
Constructor Summary
Constructors Constructor Description QuarkusUnitTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description QuarkusUnitTestaddBuildChainCustomizer(Consumer<io.quarkus.builder.BuildChainBuilder> customizer)QuarkusUnitTestaddClassLoaderEventListener(io.quarkus.bootstrap.classloading.ClassLoaderEventListener listener)voidafterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext)voidafterEach(org.junit.jupiter.api.extension.ExtensionContext context)QuarkusUnitTestassertException(Consumer<Throwable> assertException)QuarkusUnitTestassertLogRecords(Consumer<List<LogRecord>> assertLogRecords)voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext)voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context)voidclearLogRecords()RunnablegetAfterUndeployListener()Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive>getArchiveProducer()String[]getCommandLineParameters()List<LogRecord>getLogRecords()voidinterceptAfterAllMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)voidinterceptAfterEachMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)voidinterceptBeforeAllMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)voidinterceptBeforeEachMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)voidinterceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)voidinterceptTestTemplateMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)QuarkusUnitTestoverrideConfigKey(String propertyKey, String propertyValue)QuarkusUnitTestsetAfterAllCustomizer(Runnable afterAllCustomizer)QuarkusUnitTestsetAfterUndeployListener(Runnable afterUndeployListener)QuarkusUnitTestsetAllowTestClassOutsideDeployment(boolean allowTestClassOutsideDeployment)Normally access to any test classes that are not packaged in the deployment will result in a ClassNotFoundException.QuarkusUnitTestsetArchiveProducer(Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive> archiveProducer)QuarkusUnitTestsetBeforeAllCustomizer(Runnable beforeAllCustomizer)QuarkusUnitTestsetCommandLineParameters(String... commandLineParameters)QuarkusUnitTestsetExpectedException(Class<? extends Throwable> expectedException)QuarkusUnitTestsetFlatClassPath(boolean flatClassPath)If this test should use a single ClassLoader to load all the classes.QuarkusUnitTestsetForcedDependencies(List<io.quarkus.bootstrap.model.AppArtifact> 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)QuarkusUnitTestsetLogFileName(String logFileName)QuarkusUnitTestsetLogRecordPredicate(Predicate<LogRecord> predicate)QuarkusUnitTestwithConfigurationResource(String resourceName)static QuarkusUnitTestwithSecuredConnection()
-
-
-
Field Detail
-
THE_BUILD_WAS_EXPECTED_TO_FAIL
public static final String THE_BUILD_WAS_EXPECTED_TO_FAIL
- See Also:
- Constant Field Values
-
started
boolean started
-
-
Method Detail
-
setExpectedException
public QuarkusUnitTest setExpectedException(Class<? extends Throwable> expectedException)
-
withSecuredConnection
public static QuarkusUnitTest withSecuredConnection()
-
assertException
public QuarkusUnitTest assertException(Consumer<Throwable> assertException)
-
getArchiveProducer
public Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive> getArchiveProducer()
-
setArchiveProducer
public QuarkusUnitTest setArchiveProducer(Supplier<org.jboss.shrinkwrap.api.spec.JavaArchive> archiveProducer)
-
addBuildChainCustomizer
public QuarkusUnitTest addBuildChainCustomizer(Consumer<io.quarkus.builder.BuildChainBuilder> customizer)
-
addClassLoaderEventListener
public QuarkusUnitTest addClassLoaderEventListener(io.quarkus.bootstrap.classloading.ClassLoaderEventListener listener)
-
setLogFileName
public QuarkusUnitTest setLogFileName(String logFileName)
-
setLogRecordPredicate
public QuarkusUnitTest setLogRecordPredicate(Predicate<LogRecord> predicate)
-
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.
-
clearLogRecords
public void clearLogRecords()
-
assertLogRecords
public QuarkusUnitTest assertLogRecords(Consumer<List<LogRecord>> assertLogRecords)
-
setBeforeAllCustomizer
public QuarkusUnitTest setBeforeAllCustomizer(Runnable beforeAllCustomizer)
-
setAfterAllCustomizer
public QuarkusUnitTest setAfterAllCustomizer(Runnable afterAllCustomizer)
-
setForcedDependencies
public QuarkusUnitTest setForcedDependencies(List<io.quarkus.bootstrap.model.AppArtifact> 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:
interceptBeforeAllMethodin interfaceorg.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:
interceptBeforeEachMethodin interfaceorg.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:
interceptAfterEachMethodin interfaceorg.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:
interceptAfterAllMethodin interfaceorg.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:
interceptTestMethodin interfaceorg.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:
interceptTestTemplateMethodin interfaceorg.junit.jupiter.api.extension.InvocationInterceptor- Throws:
Throwable
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback- Throws:
Exception
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Exception- Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback- Throws:
Exception
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback- Throws:
Exception
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Throws:
Exception
-
getAfterUndeployListener
public Runnable getAfterUndeployListener()
-
setAfterUndeployListener
public QuarkusUnitTest setAfterUndeployListener(Runnable afterUndeployListener)
-
withConfigurationResource
public QuarkusUnitTest withConfigurationResource(String resourceName)
-
overrideConfigKey
public QuarkusUnitTest overrideConfigKey(String propertyKey, String propertyValue)
-
-