This micro library holds a set of JUnit utilities for usage with JMH testing framework.
JMH is kinda dirty. It leaves after himself a set of tests classes. They are placed in Maven generated sources directory and may cause a false positives in code analysis tools like SonarQube. JmhCleaner
rule is designed to overcome that and remove any JMH generated classes.
Use it as a standard JUnit 5 extension. One needs to pass a test class in constructor.
Example:
@RegisterExtension
static JmhCleaner cleaner = new JmhCleaner(MyClassTest.class);
JMH is, as any performance framework, sensitive to all intrusions like running java agents. Those are coverage tools (Jacoco), debuggers, profilers and so on. To overcome that one can use JavaAgentSkip
rule to automatically skip test is JAva agent is present.
Example:
@RegisterExtension
static JavaAgentSkip javaAgentSkip = JavaAgentSkip.ifPresent();
<dependency>
<groupId>pl.wavesoftware</groupId>
<artifactId>jmh-junit-utilities</artifactId>
<version>2.0.0</version>
</dependency>
Contributions are welcome!
To contribute, follow the standard git flow of:
- Fork it
- Create your feature branch (
git checkout -b feature/my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/my-new-feature
) - Create new Pull Request
Even if you can't contribute code, if you have an idea for an improvement please open an issue.
- JDK >= 1.8
-
2.0.0
- Support for JDK >= 1.8
- Support for JUnit 5
- Dropped support for JUnit 4
-
1.0.0
- Support for JDK >= 1.6
- Initial release