File tree Expand file tree Collapse file tree
utils/junit-utils/src/main/java/datadog/trace/junit/utils/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,11 @@ public void beforeAll(ExtensionContext context) {
8787 if (originalSystemProperties == null ) {
8888 saveProperties ();
8989 }
90+ // Apply class-level @WithConfig so config is available before @BeforeAll methods
91+ applyClassLevelConfig (context );
92+ if (isConfigInstanceModifiable ) {
93+ rebuildConfig ();
94+ }
9095 }
9196
9297 @ Override
@@ -116,8 +121,12 @@ public void afterAll(ExtensionContext context) {
116121 }
117122 }
118123
119- private void applyDeclaredConfig (ExtensionContext context ) {
120- // Class-level @WithConfig annotations
124+ private static void applyDeclaredConfig (ExtensionContext context ) {
125+ applyClassLevelConfig (context );
126+ applyMethodLevelConfig (context );
127+ }
128+
129+ private static void applyClassLevelConfig (ExtensionContext context ) {
121130 // Walk the entire class hierarchy so annotations on superclasses are applied
122131 // (topmost first, then subclass overrides)
123132 Class <?> testClass = context .getRequiredTestClass ();
@@ -132,6 +141,9 @@ private void applyDeclaredConfig(ExtensionContext context) {
132141 applyConfig (cfg );
133142 }
134143 }
144+ }
145+
146+ private static void applyMethodLevelConfig (ExtensionContext context ) {
135147 // Method-level @WithConfig annotations (supports composed/meta-annotations)
136148 context
137149 .getTestMethod ()
You can’t perform that action at this time.
0 commit comments