File tree Expand file tree Collapse file tree 2 files changed +42
-3
lines changed
spring-modulith-integration-test/src/test/java/com/acme/myproject/moduleA
spring-modulith-test/src/main/java/org/springframework/modulith/test Expand file tree Collapse file tree 2 files changed +42
-3
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2023 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com .acme .myproject .moduleA ;
17
+
18
+ import org .junit .jupiter .api .Nested ;
19
+ import org .junit .jupiter .api .Test ;
20
+ import org .springframework .modulith .test .ApplicationModuleTest ;
21
+
22
+ /**
23
+ * Integration tests for {@link ApplicationModuleTest}.
24
+ *
25
+ * @author Oliver Drotbohm
26
+ */
27
+ @ ApplicationModuleTest (verifyAutomatically = false )
28
+ class ApplicationModuleTestIntegrationTests {
29
+
30
+ @ Test // GH-173
31
+ void bootstrapsFirstLevelTestMethod () {}
32
+
33
+ @ Nested
34
+ class SomeNestedClass {
35
+
36
+ @ Test // GH-173
37
+ void bootstrapsSecondLevelMestMethod () {}
38
+ }
39
+ }
Original file line number Diff line number Diff line change 25
25
import org .slf4j .Logger ;
26
26
import org .slf4j .LoggerFactory ;
27
27
import org .springframework .context .ConfigurableApplicationContext ;
28
- import org .springframework .core .annotation .AnnotatedElementUtils ;
29
28
import org .springframework .modulith .core .ApplicationModule ;
30
29
import org .springframework .test .context .ContextConfigurationAttributes ;
31
30
import org .springframework .test .context .ContextCustomizer ;
32
31
import org .springframework .test .context .ContextCustomizerFactory ;
33
32
import org .springframework .test .context .MergedContextConfiguration ;
33
+ import org .springframework .test .context .TestContextAnnotationUtils ;
34
34
35
35
/**
36
36
* @author Oliver Drotbohm
@@ -45,9 +45,9 @@ class ModuleContextCustomizerFactory implements ContextCustomizerFactory {
45
45
public ContextCustomizer createContextCustomizer (Class <?> testClass ,
46
46
List <ContextConfigurationAttributes > configAttributes ) {
47
47
48
- var moduleTest = AnnotatedElementUtils . getMergedAnnotation (testClass , ApplicationModuleTest .class );
48
+ var moduleTest = TestContextAnnotationUtils . findAnnotationDescriptor (testClass , ApplicationModuleTest .class );
49
49
50
- return moduleTest == null ? null : new ModuleContextCustomizer (testClass );
50
+ return moduleTest == null ? null : new ModuleContextCustomizer (moduleTest . getRootDeclaringClass () );
51
51
}
52
52
53
53
static class ModuleContextCustomizer implements ContextCustomizer {
You can’t perform that action at this time.
0 commit comments