Skip to content

Commit bc29194

Browse files
committed
Polishing
1 parent 1bc7182 commit bc29194

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

spring-test/src/main/java/org/springframework/test/context/support/DynamicPropertiesContextCustomizer.java

+13-10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
* @author Sam Brannen
4646
* @since 5.2.5
4747
* @see DynamicPropertiesContextCustomizerFactory
48+
* @see DefaultDynamicPropertyRegistry
49+
* @see DynamicPropertySourceBeanInitializer
4850
*/
4951
class DynamicPropertiesContextCustomizer implements ContextCustomizer {
5052

@@ -59,20 +61,11 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {
5961

6062

6163
DynamicPropertiesContextCustomizer(Set<Method> methods) {
62-
methods.forEach(this::assertValid);
64+
methods.forEach(DynamicPropertiesContextCustomizer::assertValid);
6365
this.methods = methods;
6466
}
6567

6668

67-
private void assertValid(Method method) {
68-
Assert.state(Modifier.isStatic(method.getModifiers()),
69-
() -> "@DynamicPropertySource method '" + method.getName() + "' must be static");
70-
Class<?>[] types = method.getParameterTypes();
71-
Assert.state(types.length == 1 && types[0] == DynamicPropertyRegistry.class,
72-
() -> "@DynamicPropertySource method '" + method.getName() +
73-
"' must accept a single DynamicPropertyRegistry argument");
74-
}
75-
7669
@Override
7770
public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) {
7871
ConfigurableEnvironment environment = context.getEnvironment();
@@ -115,4 +108,14 @@ public int hashCode() {
115108
return this.methods.hashCode();
116109
}
117110

111+
112+
private static void assertValid(Method method) {
113+
Assert.state(Modifier.isStatic(method.getModifiers()),
114+
() -> "@DynamicPropertySource method '" + method.getName() + "' must be static");
115+
Class<?>[] types = method.getParameterTypes();
116+
Assert.state(types.length == 1 && types[0] == DynamicPropertyRegistry.class,
117+
() -> "@DynamicPropertySource method '" + method.getName() +
118+
"' must accept a single DynamicPropertyRegistry argument");
119+
}
120+
118121
}

spring-test/src/main/java/org/springframework/test/context/support/DynamicValuesPropertySource.java

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class DynamicValuesPropertySource extends MapPropertySource {
4141
super(PROPERTY_SOURCE_NAME, Collections.unmodifiableMap(valueSuppliers));
4242
}
4343

44+
4445
@Override
4546
@Nullable
4647
public Object getProperty(String name) {

0 commit comments

Comments
 (0)