Assign @SystemProperty to class / nested class and inherit on all test methods (original) (raw)
Is your feature request related to a problem? Please describe.
The example below is maybe an edge case, but I still think there is potential in the requested feature. :)
We are using the maven-git-versioning-extension in our Git project at the root to set the POM version based on branch name.
(adding extension in ".mvn/extensions.xml" and associated ".mvn/maven-git-versioning-extension.xml".)
Unfortunately, this is also picked up within the integration tests by default.
So for example, if we want to test that the version of a modified POM is "1.2.3-SNAPSHOT" it is changed to "1.2.3-hotfix-SNAPSHOT".
I have workarounds now by defining the following on every single test-method.
@MavenGoal("install")
@MavenTest
@SystemProperty(value = "versioning.disable", content="true") // disable maven-git-versioning-extension for IT tests
public void test_001(final MavenExecutionResult result) { ... }
I tried defining this @SystemProperty annotation on the test class (and the @Nested classes); however, it does not propagate to the test methods.
Describe the solution you'd like
What would be great is to just be able to define the @SystemProperty at class-level and have it propagate to all methods (and methods in @Nested subclasses).
I am assuming that the same argument might be made for the @MavenOption annotation but that is not where I am having the problem. :)
Additional context
Sample error:
java.lang.AssertionError: [GAVP]
Expecting:
<["me.jwt007.maven.plugins.foobar.its",
"foobar-bom-001",
"1.0.1-hotfix-SNAPSHOT",
"pom"]>
to contain exactly (and in same order):
<["me.jwt007.maven.plugins.foobar.its", "foobar-bom-001", "1.2.3", "pom"]>
but some elements were not found:
<["1.2.3"]>
and others were not expected:
<["1.0.1-hotfix-SNAPSHOT"]>