Package org.codehaus.plexus.testing
Class PlexusExtension
java.lang.Object
org.codehaus.plexus.testing.PlexusExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension
public class PlexusExtension
extends Object
implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
This is a slightly modified version of the original plexus class
available at https://raw.githubusercontent.com/codehaus-plexus/plexus-containers/master/plexus-container-default/
src/main/java/org/codehaus/plexus/PlexusTestCase.java
in order to migrate the tests to JUnit 5.
- Author:
- Jason van Zyl, Trygve Laugstøl, Michal Maczka, Guillaume Nodet
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterEach(org.junit.jupiter.api.extension.ExtensionContext context) voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context) protected voidcustomizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration containerConfiguration) Allow custom test case implementations do augment the default container configuration before executing tests.protected voidcustomizeContext(org.codehaus.plexus.context.Context context) static Stringprotected StringgetConfigurationName(org.junit.jupiter.api.extension.ExtensionContext context) Allow the retrieval of a container configuration that is based on the name of the test class being run.org.codehaus.plexus.PlexusContainergetContainer(org.junit.jupiter.api.extension.ExtensionContext context) protected Stringprotected StringgetTestBasedir(org.junit.jupiter.api.extension.ExtensionContext context) The base directory for the test instance.static StringgetTestConfiguration(Class<?> clazz) static FilegetTestFile(String path) static FilegetTestFile(String basedir, String path) static StringgetTestPath(String path) static StringgetTestPath(String basedir, String path) protected voidsetTestBasedir(String testBasedir, org.junit.jupiter.api.extension.ExtensionContext context) Set the base directory for the test instance.
-
Field Details
-
BASEDIR_KEY
- See Also:
-
-
Constructor Details
-
PlexusExtension
public PlexusExtension()
-
-
Method Details
-
beforeEach
- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Throws:
Exception
-
customizeContainerConfiguration
protected void customizeContainerConfiguration(org.codehaus.plexus.ContainerConfiguration containerConfiguration) Allow custom test case implementations do augment the default container configuration before executing tests.- Parameters:
containerConfiguration-ContainerConfiguration.
-
customizeContext
protected void customizeContext(org.codehaus.plexus.context.Context context) -
afterEach
- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback- Throws:
Exception
-
getTestBasedir
The base directory for the test instance. By default, this is the same as the basedir.- Parameters:
context- the test execution context- Returns:
- the testBasedir
- Since:
- 1.7.0
-
setTestBasedir
protected void setTestBasedir(String testBasedir, org.junit.jupiter.api.extension.ExtensionContext context) Set the base directory for the test instance. By default, this is the same as the basedir.- Parameters:
testBasedir- the testBasedir for the test instancecontext- the test execution context- Since:
- 1.7.0
-
getContainer
public org.codehaus.plexus.PlexusContainer getContainer(org.junit.jupiter.api.extension.ExtensionContext context) -
getCustomConfigurationName
-
getConfigurationName
Allow the retrieval of a container configuration that is based on the name of the test class being run. So if you have a test class called org.foo.FunTest, then this will produce a resource name of org/foo/FunTest.xml which would be used to configure the Plexus container before running your test.- Returns:
- A configruation name
-
getTestFile
-
getTestFile
-
getTestPath
-
getTestPath
-
getBasedir
-
getTestConfiguration
-