Description
If the JUnit Open Feature Extension is used, a developer needs to use the @Flag
annotation on @Test
and @ParameterizedTest
methods.
By intercepting the test method, the OpenFeatureExtension
sets the current namespace for the TestProvider
which is used later on in the evaluation. This is done by implementing the interface InvocationInterceptor
and overriding the method interceptTestMethod
.
Actually, the method interceptTestMethod
does not intercept methods annotated with @ParameterizedTest
. This leads to the issue that during the feature flag evaluation, the current namespace is not set int the TestProvider
and therefore, the flag values cannot be stubbed with the annotation @Flag
.
To fix the issue not only the method interceptTestMethod
must be overridden, but InvocationInterceptor.interceptTestTemplateMethod()
must be overridden as well.
A/C
@Flag annotation mocks feature flags on test methods annotated with @test and @ParameterizedTest