Skip to content

Commit efd9aa9

Browse files
committed
Polish
1 parent e01e4f1 commit efd9aa9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

spring-boot-project/spring-boot-testcontainers/src/main/java/org/springframework/boot/testcontainers/service/connection/ServiceConnectionContextCustomizerFactory.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ class ServiceConnectionContextCustomizerFactory implements ContextCustomizerFact
4949
public ContextCustomizer createContextCustomizer(Class<?> testClass,
5050
List<ContextConfigurationAttributes> configAttributes) {
5151
List<ContainerConnectionSource<?>> sources = new ArrayList<>();
52-
findSources(testClass, sources);
52+
collectSources(testClass, sources);
5353
return new ServiceConnectionContextCustomizer(sources);
5454
}
5555

56-
private void findSources(Class<?> clazz, List<ContainerConnectionSource<?>> sources) {
57-
if (clazz == Object.class || clazz == null) {
56+
private void collectSources(Class<?> candidate, List<ContainerConnectionSource<?>> sources) {
57+
if (candidate == Object.class || candidate == null) {
5858
return;
5959
}
60-
ReflectionUtils.doWithLocalFields(clazz, (field) -> {
60+
ReflectionUtils.doWithLocalFields(candidate, (field) -> {
6161
MergedAnnotations annotations = MergedAnnotations.from(field);
6262
annotations.stream(ServiceConnection.class)
6363
.forEach((annotation) -> sources.add(createSource(field, annotation)));
6464
});
65-
if (TestContextAnnotationUtils.searchEnclosingClass(clazz)) {
66-
findSources(clazz.getEnclosingClass(), sources);
65+
if (TestContextAnnotationUtils.searchEnclosingClass(candidate)) {
66+
collectSources(candidate.getEnclosingClass(), sources);
6767
}
68-
for (Class<?> implementedInterface : clazz.getInterfaces()) {
69-
findSources(implementedInterface, sources);
68+
for (Class<?> implementedInterface : candidate.getInterfaces()) {
69+
collectSources(implementedInterface, sources);
7070
}
71-
findSources(clazz.getSuperclass(), sources);
71+
collectSources(candidate.getSuperclass(), sources);
7272
}
7373

7474
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)