Skip to content

Commit 5513139

Browse files
committed
Clean up warnings and revise for consistency
1 parent bb7c497 commit 5513139

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

spring-web/src/test/java/org/springframework/http/converter/DefaultHttpMessageConvertersTests.java

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.http.converter;
1818

19-
2019
import java.io.IOException;
2120
import java.net.URL;
2221
import java.net.URLClassLoader;
@@ -29,7 +28,6 @@
2928
import org.junit.jupiter.api.Nested;
3029
import org.junit.jupiter.api.Test;
3130
import org.junit.jupiter.params.ParameterizedTest;
32-
import org.junit.jupiter.params.provider.Arguments;
3331
import org.junit.jupiter.params.provider.MethodSource;
3432

3533
import org.springframework.core.SmartClassLoader;
@@ -54,17 +52,16 @@
5452
@SuppressWarnings("removal")
5553
class DefaultHttpMessageConvertersTests {
5654

57-
5855
@ParameterizedTest
5956
@MethodSource("emptyMessageConverters")
6057
void emptyConverters(Iterable<HttpMessageConverter<?>> converters) {
6158
assertThat(converters).isEmpty();
6259
}
6360

64-
static Stream<Arguments> emptyMessageConverters() {
61+
static Stream<Iterable<HttpMessageConverter<?>>> emptyMessageConverters() {
6562
return Stream.of(
66-
Arguments.of(HttpMessageConverters.create().build().forClient()),
67-
Arguments.of(HttpMessageConverters.create().build().forServer())
63+
HttpMessageConverters.create().build().forClient(),
64+
HttpMessageConverters.create().build().forServer()
6865
);
6966
}
7067

@@ -79,46 +76,47 @@ void clientAndServerConvertersAreShared() {
7976

8077
@Test
8178
void failsWhenStringConverterDoesNotSupportMediaType() {
82-
assertThatIllegalArgumentException().isThrownBy(() ->
83-
HttpMessageConverters.create().stringMessageConverter(new CustomHttpMessageConverter()).build())
79+
assertThatIllegalArgumentException()
80+
.isThrownBy(() -> HttpMessageConverters.create().stringMessageConverter(new CustomHttpMessageConverter()).build())
8481
.withMessage("stringMessageConverter should support 'text/plain'");
8582
}
8683

8784
@Test
8885
void failsWhenJsonConverterDoesNotSupportMediaType() {
89-
assertThatIllegalArgumentException().isThrownBy(() ->
90-
HttpMessageConverters.create().jsonMessageConverter(new CustomHttpMessageConverter()).build())
86+
assertThatIllegalArgumentException()
87+
.isThrownBy(() -> HttpMessageConverters.create().jsonMessageConverter(new CustomHttpMessageConverter()).build())
9188
.withMessage("jsonMessageConverter should support 'application/json'");
9289
}
9390

9491
@Test
9592
void failsWhenXmlConverterDoesNotSupportMediaType() {
96-
assertThatIllegalArgumentException().isThrownBy(() ->
97-
HttpMessageConverters.create().xmlMessageConverter(new CustomHttpMessageConverter()).build())
93+
assertThatIllegalArgumentException()
94+
.isThrownBy(() -> HttpMessageConverters.create().xmlMessageConverter(new CustomHttpMessageConverter()).build())
9895
.withMessage("xmlMessageConverter should support 'text/xml'");
9996
}
10097

10198
@Test
10299
void failsWhenSmileConverterDoesNotSupportMediaType() {
103-
assertThatIllegalArgumentException().isThrownBy(() ->
104-
HttpMessageConverters.create().smileMessageConverter(new CustomHttpMessageConverter()).build())
100+
assertThatIllegalArgumentException()
101+
.isThrownBy(() -> HttpMessageConverters.create().smileMessageConverter(new CustomHttpMessageConverter()).build())
105102
.withMessage("smileMessageConverter should support 'application/x-jackson-smile'");
106103
}
107104

108105
@Test
109106
void failsWhenCborConverterDoesNotSupportMediaType() {
110-
assertThatIllegalArgumentException().isThrownBy(() ->
111-
HttpMessageConverters.create().cborMessageConverter(new CustomHttpMessageConverter()).build())
107+
assertThatIllegalArgumentException()
108+
.isThrownBy(() -> HttpMessageConverters.create().cborMessageConverter(new CustomHttpMessageConverter()).build())
112109
.withMessage("cborMessageConverter should support 'application/cbor'");
113110
}
114111

115112
@Test
116113
void failsWhenYamlConverterDoesNotSupportMediaType() {
117-
assertThatIllegalArgumentException().isThrownBy(() ->
118-
HttpMessageConverters.create().yamlMessageConverter(new CustomHttpMessageConverter()).build())
114+
assertThatIllegalArgumentException()
115+
.isThrownBy(() -> HttpMessageConverters.create().yamlMessageConverter(new CustomHttpMessageConverter()).build())
119116
.withMessage("yamlMessageConverter should support 'application/yaml'");
120117
}
121118

119+
122120
@Nested
123121
class ClientConvertersTests {
124122

@@ -134,7 +132,6 @@ void defaultConverters() {
134132
AtomFeedHttpMessageConverter.class, RssChannelHttpMessageConverter.class);
135133
}
136134

137-
138135
@Test
139136
void multipartConverterContainsOtherConverters() {
140137
var converters = HttpMessageConverters.withDefaults().build();
@@ -177,7 +174,7 @@ void shouldUseServerSpecificConverter() {
177174
@Test
178175
void shouldConfigureConverter() {
179176
CustomHttpMessageConverter customConverter = new CustomHttpMessageConverter();
180-
var converters = HttpMessageConverters.withDefaults()
177+
HttpMessageConverters.withDefaults()
181178
.additionalMessageConverter(customConverter)
182179
.configureClient(configurer -> {
183180
configurer.configureClientMessageConverters(converter -> {
@@ -192,6 +189,7 @@ void shouldConfigureConverter() {
192189

193190
}
194191

192+
195193
@Nested
196194
class ServerConvertersTests {
197195

@@ -250,7 +248,7 @@ void shouldUseServerSpecificConverter() {
250248
@Test
251249
void shouldConfigureConverter() {
252250
CustomHttpMessageConverter customConverter = new CustomHttpMessageConverter();
253-
var converters = HttpMessageConverters.withDefaults()
251+
HttpMessageConverters.withDefaults()
254252
.additionalMessageConverter(customConverter)
255253
.configureServer(configurer -> {
256254
configurer.configureServerMessageConverters(converter -> {

0 commit comments

Comments
 (0)