Skip to content

Commit 23d8d60

Browse files
committed
Polish
1 parent b2ec7c5 commit 23d8d60

File tree

7 files changed

+36
-41
lines changed

7 files changed

+36
-41
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ public CompositeMeterRegistry compositeMeterRegistry(
8888
MetricsProperties metricsProperties,
8989
ObjectProvider<Collection<MetricsExporter>> exporters,
9090
ObjectProvider<Collection<MeterRegistryConfigurer>> configurers) {
91-
CompositeMeterRegistry composite = metricsProperties.isUseGlobalRegistry() ?
92-
Metrics.globalRegistry : new CompositeMeterRegistry();
91+
CompositeMeterRegistry composite = metricsProperties.isUseGlobalRegistry()
92+
? Metrics.globalRegistry : new CompositeMeterRegistry();
9393
configurers.getIfAvailable(Collections::emptyList)
9494
.forEach((configurer) -> configurer.configureRegistry(composite));
95-
exporters.getIfAvailable(Collections::emptyList).forEach(exporter -> {
95+
exporters.getIfAvailable(Collections::emptyList).forEach((exporter) -> {
9696
MeterRegistry childRegistry = exporter.registry();
9797
if (composite == childRegistry) {
9898
throw new IllegalStateException(

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterAutoTimedTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ public class WebMvcMetricsFilterAutoTimedTests {
5555
@Autowired
5656
private MeterRegistry registry;
5757

58-
@Autowired
59-
private MockClock clock;
60-
6158
@Autowired
6259
private WebApplicationContext context;
6360

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsIntegrationTests.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ public class WebMvcMetricsIntegrationTests {
6565
@Autowired
6666
private SimpleMeterRegistry registry;
6767

68-
@Autowired
69-
private MockClock clock;
70-
7168
private MockMvc mvc;
7269

7370
@Autowired

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class GsonAutoConfiguration {
4646
@ConditionalOnMissingBean(GsonBuilder.class)
4747
public GsonBuilder gsonBuilder(List<GsonBuilderCustomizer> customizers) {
4848
GsonBuilder builder = new GsonBuilder();
49-
customizers.forEach(c -> c.customize(builder));
49+
customizers.forEach((c) -> c.customize(builder));
5050
return builder;
5151
}
5252

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfigurationTests.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class GsonAutoConfigurationTests {
5151

5252
@Test
5353
public void gsonRegistration() {
54-
this.contextRunner.run(context -> {
54+
this.contextRunner.run((context) -> {
5555
Gson gson = context.getBean(Gson.class);
5656
assertThat(gson.toJson(new DataObject())).isEqualTo("{\"data\":1}");
5757
});
@@ -61,7 +61,7 @@ public void gsonRegistration() {
6161
public void generateNonExecutableJson() {
6262
this.contextRunner
6363
.withPropertyValues("spring.gson.generate-non-executable-json:true")
64-
.run(context -> {
64+
.run((context) -> {
6565
Gson gson = context.getBean(Gson.class);
6666
assertThat(gson.toJson(new DataObject()))
6767
.isNotEqualTo("{\"data\":1}");
@@ -74,7 +74,7 @@ public void excludeFieldsWithoutExposeAnnotation() {
7474
this.contextRunner
7575
.withPropertyValues(
7676
"spring.gson.exclude-fields-without-expose-annotation:true")
77-
.run(context -> {
77+
.run((context) -> {
7878
Gson gson = context.getBean(Gson.class);
7979
assertThat(gson.toJson(new DataObject())).isEqualTo("{}");
8080
});
@@ -83,7 +83,7 @@ public void excludeFieldsWithoutExposeAnnotation() {
8383
@Test
8484
public void serializeNulls() {
8585
this.contextRunner.withPropertyValues("spring.gson.serialize-nulls:true")
86-
.run(context -> {
86+
.run((context) -> {
8787
Gson gson = context.getBean(Gson.class);
8888
assertThat(gson.serializeNulls()).isTrue();
8989
});
@@ -94,7 +94,7 @@ public void enableComplexMapKeySerialization() {
9494
this.contextRunner
9595
.withPropertyValues(
9696
"spring.gson.enable-complex-map-key-serialization:true")
97-
.run(context -> {
97+
.run((context) -> {
9898
Gson gson = context.getBean(Gson.class);
9999
Map<DataObject, String> original = new LinkedHashMap<>();
100100
original.put(new DataObject(), "a");
@@ -104,7 +104,7 @@ public void enableComplexMapKeySerialization() {
104104

105105
@Test
106106
public void notDisableInnerClassSerialization() {
107-
this.contextRunner.run(context -> {
107+
this.contextRunner.run((context) -> {
108108
Gson gson = context.getBean(Gson.class);
109109
WrapperObject wrapperObject = new WrapperObject();
110110
assertThat(gson.toJson(wrapperObject.new NestedObject()))
@@ -116,7 +116,7 @@ public void notDisableInnerClassSerialization() {
116116
public void disableInnerClassSerialization() {
117117
this.contextRunner
118118
.withPropertyValues("spring.gson.disable-inner-class-serialization:true")
119-
.run(context -> {
119+
.run((context) -> {
120120
Gson gson = context.getBean(Gson.class);
121121
WrapperObject wrapperObject = new WrapperObject();
122122
assertThat(gson.toJson(wrapperObject.new NestedObject()))
@@ -128,7 +128,7 @@ public void disableInnerClassSerialization() {
128128
public void withLongSerializationPolicy() {
129129
this.contextRunner.withPropertyValues(
130130
"spring.gson.long-serialization-policy:" + LongSerializationPolicy.STRING)
131-
.run(context -> {
131+
.run((context) -> {
132132
Gson gson = context.getBean(Gson.class);
133133
assertThat(gson.toJson(new DataObject()))
134134
.isEqualTo("{\"data\":\"1\"}");
@@ -141,7 +141,7 @@ public void withFieldNamingPolicy() {
141141
this.contextRunner
142142
.withPropertyValues(
143143
"spring.gson.field-naming-policy:" + fieldNamingPolicy)
144-
.run(context -> {
144+
.run((context) -> {
145145
Gson gson = context.getBean(Gson.class);
146146
assertThat(gson.fieldNamingStrategy()).isEqualTo(fieldNamingPolicy);
147147
});
@@ -150,7 +150,7 @@ public void withFieldNamingPolicy() {
150150
@Test
151151
public void additionalGsonBuilderCustomization() {
152152
this.contextRunner.withUserConfiguration(GsonBuilderCustomizerConfig.class)
153-
.run(context -> {
153+
.run((context) -> {
154154
Gson gson = context.getBean(Gson.class);
155155
assertThat(gson.toJson(new DataObject())).isEqualTo("{}");
156156
});
@@ -159,7 +159,7 @@ public void additionalGsonBuilderCustomization() {
159159
@Test
160160
public void customGsonBuilder() {
161161
this.contextRunner.withUserConfiguration(GsonBuilderConfig.class)
162-
.run(context -> {
162+
.run((context) -> {
163163
Gson gson = context.getBean(Gson.class);
164164
assertThat(gson.toJson(new DataObject()))
165165
.isEqualTo("{\"data\":1,\"owner\":null}");
@@ -169,7 +169,7 @@ public void customGsonBuilder() {
169169
@Test
170170
public void withPrettyPrinting() {
171171
this.contextRunner.withPropertyValues("spring.gson.pretty-printing:true")
172-
.run(context -> {
172+
.run((context) -> {
173173
Gson gson = context.getBean(Gson.class);
174174
assertThat(gson.toJson(new DataObject()))
175175
.isEqualTo("{\n \"data\": 1\n}");
@@ -178,7 +178,7 @@ public void withPrettyPrinting() {
178178

179179
@Test
180180
public void withoutLenient() {
181-
this.contextRunner.run(context -> {
181+
this.contextRunner.run((context) -> {
182182
Gson gson = context.getBean(Gson.class);
183183
/*
184184
* It seems that lenient setting not work in version 2.8.2. We get access to
@@ -194,23 +194,24 @@ public void withoutLenient() {
194194

195195
@Test
196196
public void withLenient() {
197-
this.contextRunner.withPropertyValues("spring.gson.lenient:true").run(context -> {
198-
Gson gson = context.getBean(Gson.class);
199-
/*
200-
* It seems that lenient setting not work in version 2.8.2. We get access to
201-
* it via reflection
202-
*/
203-
Field lenientField = gson.getClass().getDeclaredField("lenient");
204-
lenientField.setAccessible(true);
205-
boolean lenient = lenientField.getBoolean(gson);
206-
207-
assertThat(lenient).isTrue();
208-
});
197+
this.contextRunner.withPropertyValues("spring.gson.lenient:true")
198+
.run((context) -> {
199+
Gson gson = context.getBean(Gson.class);
200+
/*
201+
* It seems that lenient setting not work in version 2.8.2. We get
202+
* access to it via reflection
203+
*/
204+
Field lenientField = gson.getClass().getDeclaredField("lenient");
205+
lenientField.setAccessible(true);
206+
boolean lenient = lenientField.getBoolean(gson);
207+
208+
assertThat(lenient).isTrue();
209+
});
209210
}
210211

211212
@Test
212213
public void withHtmlEscaping() {
213-
this.contextRunner.run(context -> {
214+
this.contextRunner.run((context) -> {
214215
Gson gson = context.getBean(Gson.class);
215216
assertThat(gson.htmlSafe()).isTrue();
216217
});
@@ -219,7 +220,7 @@ public void withHtmlEscaping() {
219220
@Test
220221
public void withoutHtmlEscaping() {
221222
this.contextRunner.withPropertyValues("spring.gson.disable-html-escaping:true")
222-
.run(context -> {
223+
.run((context) -> {
223224
Gson gson = context.getBean(Gson.class);
224225
assertThat(gson.htmlSafe()).isFalse();
225226
});
@@ -229,7 +230,7 @@ public void withoutHtmlEscaping() {
229230
@Test
230231
public void customDateFormat() {
231232
this.contextRunner.withPropertyValues("spring.gson.date-format:H")
232-
.run(context -> {
233+
.run((context) -> {
233234
Gson gson = context.getBean(Gson.class);
234235
DateTime dateTime = new DateTime(1988, 6, 25, 20, 30);
235236
Date date = dateTime.toDate();

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/ConfigurableUndertowWebServerFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import java.io.File;
2020

21-
import io.undertow.Undertow;
21+
import io.undertow.Undertow.Builder;
2222
import io.undertow.servlet.api.DeploymentInfo;
2323

2424
/**
@@ -33,7 +33,7 @@ public interface ConfigurableUndertowWebServerFactory {
3333

3434
/**
3535
* Add {@link UndertowBuilderCustomizer}s that should be used to customize the
36-
* Undertow {@link Undertow.Builder}.
36+
* Undertow {@link Builder}.
3737
* @param customizers the customizers to add
3838
*/
3939
void addBuilderCustomizers(UndertowBuilderCustomizer... customizers);

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/MapBinderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ static class MapConverter implements Converter<String, Map<String, String>> {
611611
@Override
612612
public Map<String, String> convert(String s) {
613613
Map<String, String> map = new HashMap<>();
614-
StringUtils.commaDelimitedListToSet(s).forEach(k -> map.put(k, ""));
614+
StringUtils.commaDelimitedListToSet(s).forEach((k) -> map.put(k, ""));
615615
return map;
616616
}
617617

0 commit comments

Comments
 (0)