A JUnit 5 extension for testing JSR-330 components. Annotate a test class with @PlexusTest and your
@Inject fields are populated from a container built for that test.
Status
Maintained. Small and stable — it exists so the other projects here can test their components without each inventing the same fixture.
Using it
<dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-testing</artifactId> <version>2.1.0</version> <scope>test</scope> </dependency>
Check the badge above for the current version.
@PlexusTest class MyComponentTest { @Inject MyComponent component; @Test void itWorks() { assertNotNull( component ); } }
A test class can customise the container by implementing
PlexusTestConfiguration;
every method has a default, so implement only the ones you need. The
project site shows the full examples, compiled from
this repository's own tests.
Requirements
Java 8 or later, and JUnit 5.
Documentation
Contributing
See CONTRIBUTING.md. In short:
mvn verify builds, and run mvn spotless:apply before pushing or CI will fail on formatting.
Please report security vulnerabilities privately — see SECURITY.md, not a public issue.