mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Merge branch '7.0.x'
This commit is contained in:
@@ -64,7 +64,7 @@ class HttpEntityTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEquals() {
|
||||
void equals() {
|
||||
HttpHeaders headers1 = new HttpHeaders();
|
||||
headers1.set("Content-Type", "text/plain");
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ class HttpRangeTests {
|
||||
}
|
||||
|
||||
@Test // gh-23576
|
||||
public void toResourceRegionStartingAtResourceByteCount() {
|
||||
void toResourceRegionStartingAtResourceByteCount() {
|
||||
byte[] bytes = "Spring Framework".getBytes(StandardCharsets.UTF_8);
|
||||
ByteArrayResource resource = new ByteArrayResource(bytes);
|
||||
HttpRange range = HttpRange.createByteRange(resource.contentLength());
|
||||
|
||||
@@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.within;
|
||||
class MediaTypeTests {
|
||||
|
||||
@Test
|
||||
void testToString() {
|
||||
void toStringOutput() {
|
||||
MediaType mediaType = new MediaType("text", "plain", 0.7);
|
||||
String result = mediaType.toString();
|
||||
assertThat(result).as("Invalid toString() returned").isEqualTo("text/plain;q=0.7");
|
||||
@@ -163,7 +163,7 @@ class MediaTypeTests {
|
||||
}
|
||||
|
||||
@Test // gh-23241
|
||||
public void parseMediaTypesWithTrailingComma() {
|
||||
void parseMediaTypesWithTrailingComma() {
|
||||
List<MediaType> mediaTypes = MediaType.parseMediaTypes("text/plain, text/html, ");
|
||||
assertThat(mediaTypes).as("No media types returned").isNotNull();
|
||||
assertThat(mediaTypes).as("Incorrect number of media types").hasSize(2);
|
||||
@@ -279,7 +279,7 @@ class MediaTypeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWithConversionService() {
|
||||
void withConversionService() {
|
||||
ConversionService conversionService = new DefaultConversionService();
|
||||
assertThat(conversionService.canConvert(String.class, MediaType.class)).isTrue();
|
||||
MediaType mediaType = MediaType.parseMediaType("application/xml");
|
||||
|
||||
@@ -83,7 +83,7 @@ class ResponseCookieTests {
|
||||
}
|
||||
|
||||
@Test // gh-24663
|
||||
public void domainWithEmptyDoubleQuotes() {
|
||||
void domainWithEmptyDoubleQuotes() {
|
||||
|
||||
Arrays.asList("\"\"", "\t\"\" ", " \" \t \"\t")
|
||||
.forEach(domain -> {
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ class JdkClientHttpRequestFactoryTests extends AbstractHttpRequestFactoryTests {
|
||||
}
|
||||
|
||||
@Test // gh-31451
|
||||
public void contentLength0() throws IOException {
|
||||
void contentLength0() throws IOException {
|
||||
URI uri = URI.create(this.baseUrl + "/methods/get");
|
||||
ClientHttpRequest request =
|
||||
new BufferingClientHttpRequestFactory(this.factory).createRequest(uri, HttpMethod.GET);
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ class MultipartBodyBuilderTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16601
|
||||
public void publisherEntityAcceptedAsInput() {
|
||||
void publisherEntityAcceptedAsInput() {
|
||||
|
||||
Publisher<String> publisher = Flux.just("foo", "bar", "baz");
|
||||
MultipartBodyBuilder builder = new MultipartBodyBuilder();
|
||||
|
||||
+2
-2
@@ -80,7 +80,7 @@ public class SimpleClientHttpRequestFactoryTests extends AbstractHttpRequestFact
|
||||
}
|
||||
|
||||
@Test // SPR-8809
|
||||
public void interceptor() throws Exception {
|
||||
void interceptor() throws Exception {
|
||||
final String headerName = "MyHeader";
|
||||
final String headerValue = "MyValue";
|
||||
ClientHttpRequestInterceptor interceptor = (request, body, execution) -> {
|
||||
@@ -106,7 +106,7 @@ public class SimpleClientHttpRequestFactoryTests extends AbstractHttpRequestFact
|
||||
}
|
||||
|
||||
@Test // SPR-13225
|
||||
public void headerWithNullValue() {
|
||||
void headerWithNullValue() {
|
||||
HttpURLConnection urlConnection = mock();
|
||||
given(urlConnection.getRequestMethod()).willReturn("GET");
|
||||
|
||||
|
||||
+5
-5
@@ -47,7 +47,7 @@ class SimpleClientHttpResponseTests {
|
||||
|
||||
|
||||
@Test // SPR-14040
|
||||
public void shouldNotCloseConnectionWhenResponseClosed() throws Exception {
|
||||
void shouldNotCloseConnectionWhenResponseClosed() throws Exception {
|
||||
TestByteArrayInputStream is = new TestByteArrayInputStream("Spring".getBytes(StandardCharsets.UTF_8));
|
||||
given(this.connection.getResponseCode()).willReturn(200);
|
||||
given(this.connection.getInputStream()).willReturn(is);
|
||||
@@ -61,7 +61,7 @@ class SimpleClientHttpResponseTests {
|
||||
}
|
||||
|
||||
@Test // SPR-14040
|
||||
public void shouldDrainStreamWhenResponseClosed() throws Exception {
|
||||
void shouldDrainStreamWhenResponseClosed() throws Exception {
|
||||
byte[] buf = new byte[6];
|
||||
TestByteArrayInputStream is = new TestByteArrayInputStream("SpringSpring".getBytes(StandardCharsets.UTF_8));
|
||||
given(this.connection.getResponseCode()).willReturn(200);
|
||||
@@ -79,7 +79,7 @@ class SimpleClientHttpResponseTests {
|
||||
}
|
||||
|
||||
@Test // SPR-14040
|
||||
public void shouldDrainErrorStreamWhenResponseClosed() throws Exception {
|
||||
void shouldDrainErrorStreamWhenResponseClosed() throws Exception {
|
||||
byte[] buf = new byte[6];
|
||||
TestByteArrayInputStream is = new TestByteArrayInputStream("SpringSpring".getBytes(StandardCharsets.UTF_8));
|
||||
given(this.connection.getResponseCode()).willReturn(404);
|
||||
@@ -97,7 +97,7 @@ class SimpleClientHttpResponseTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16773
|
||||
public void shouldNotDrainWhenErrorStreamClosed() throws Exception {
|
||||
void shouldNotDrainWhenErrorStreamClosed() throws Exception {
|
||||
InputStream is = mock();
|
||||
given(this.connection.getResponseCode()).willReturn(404);
|
||||
given(this.connection.getErrorStream()).willReturn(is);
|
||||
@@ -115,7 +115,7 @@ class SimpleClientHttpResponseTests {
|
||||
}
|
||||
|
||||
@Test // SPR-17181
|
||||
public void shouldDrainResponseEvenIfResponseNotRead() throws Exception {
|
||||
void shouldDrainResponseEvenIfResponseNotRead() throws Exception {
|
||||
TestByteArrayInputStream is = new TestByteArrayInputStream("SpringSpring".getBytes(StandardCharsets.UTF_8));
|
||||
given(this.connection.getResponseCode()).willReturn(200);
|
||||
given(this.connection.getInputStream()).willReturn(is);
|
||||
|
||||
+7
-7
@@ -65,7 +65,7 @@ class CancelWithoutDemandCodecTests {
|
||||
|
||||
|
||||
@Test // gh-22107
|
||||
public void cancelWithEncoderHttpMessageWriterAndSingleValue() {
|
||||
void cancelWithEncoderHttpMessageWriterAndSingleValue() {
|
||||
CharSequenceEncoder encoder = CharSequenceEncoder.allMimeTypes();
|
||||
HttpMessageWriter<CharSequence> writer = new EncoderHttpMessageWriter<>(encoder);
|
||||
CancellingOutputMessage outputMessage = new CancellingOutputMessage(this.bufferFactory);
|
||||
@@ -75,7 +75,7 @@ class CancelWithoutDemandCodecTests {
|
||||
}
|
||||
|
||||
@Test // gh-22107
|
||||
public void cancelWithJackson() {
|
||||
void cancelWithJackson() {
|
||||
JacksonJsonEncoder encoder = new JacksonJsonEncoder();
|
||||
|
||||
Flux<DataBuffer> flux = encoder.encode(Flux.just(new Pojo("foofoo", "barbar"), new Pojo("bar", "baz")),
|
||||
@@ -88,7 +88,7 @@ class CancelWithoutDemandCodecTests {
|
||||
}
|
||||
|
||||
@Test // gh-22107
|
||||
public void cancelWithJaxb2() {
|
||||
void cancelWithJaxb2() {
|
||||
Jaxb2XmlEncoder encoder = new Jaxb2XmlEncoder();
|
||||
|
||||
Flux<DataBuffer> flux = encoder.encode(Mono.just(new Pojo("foo", "bar")),
|
||||
@@ -101,7 +101,7 @@ class CancelWithoutDemandCodecTests {
|
||||
}
|
||||
|
||||
@Test // gh-22543
|
||||
public void cancelWithProtobufEncoder() {
|
||||
void cancelWithProtobufEncoder() {
|
||||
ProtobufEncoder encoder = new ProtobufEncoder();
|
||||
Msg msg = Msg.newBuilder().setFoo("Foo").setBlah(SecondMsg.newBuilder().setBlah(123).build()).build();
|
||||
|
||||
@@ -115,7 +115,7 @@ class CancelWithoutDemandCodecTests {
|
||||
}
|
||||
|
||||
@Test // gh-22731
|
||||
public void cancelWithProtobufDecoder() {
|
||||
void cancelWithProtobufDecoder() {
|
||||
ProtobufDecoder decoder = new ProtobufDecoder();
|
||||
|
||||
Mono<DataBuffer> input = Mono.fromCallable(() -> {
|
||||
@@ -134,7 +134,7 @@ class CancelWithoutDemandCodecTests {
|
||||
}
|
||||
|
||||
@Test // gh-22107
|
||||
public void cancelWithMultipartContent() {
|
||||
void cancelWithMultipartContent() {
|
||||
MultipartBodyBuilder builder = new MultipartBodyBuilder();
|
||||
builder.part("part1", "value1");
|
||||
builder.part("part2", "value2");
|
||||
@@ -148,7 +148,7 @@ class CancelWithoutDemandCodecTests {
|
||||
}
|
||||
|
||||
@Test // gh-22107
|
||||
public void cancelWithSse() {
|
||||
void cancelWithSse() {
|
||||
ServerSentEvent<?> event = ServerSentEvent.builder().data("bar").id("c42").event("foo").build();
|
||||
ServerSentEventHttpMessageWriter writer = new ServerSentEventHttpMessageWriter(new JacksonJsonEncoder());
|
||||
CancellingOutputMessage outputMessage = new CancellingOutputMessage(this.bufferFactory);
|
||||
|
||||
+2
-2
@@ -202,7 +202,7 @@ class EncoderHttpMessageWriterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noContentTypeWithEmptyBody() {
|
||||
void noContentTypeWithEmptyBody() {
|
||||
Encoder<CharSequence> encoder = CharSequenceEncoder.textPlainOnly();
|
||||
HttpMessageWriter<CharSequence> writer = new EncoderHttpMessageWriter<>(encoder);
|
||||
Mono<Void> writerMono = writer.write(Mono.empty(), ResolvableType.forClass(String.class),
|
||||
@@ -214,7 +214,7 @@ class EncoderHttpMessageWriterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void zeroContentLengthWithEmptyBody() {
|
||||
void zeroContentLengthWithEmptyBody() {
|
||||
Encoder<CharSequence> encoder = CharSequenceEncoder.textPlainOnly();
|
||||
HttpMessageWriter<CharSequence> writer = new EncoderHttpMessageWriter<>(encoder);
|
||||
Mono<Void> writerMono = writer.write(Mono.empty(), ResolvableType.forClass(String.class),
|
||||
|
||||
@@ -239,7 +239,7 @@ class JacksonTokenizerTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLimit() {
|
||||
void limit() {
|
||||
List<String> source = asList(
|
||||
"[",
|
||||
"{", "\"id\":1,\"name\":\"Dan\"", "},",
|
||||
@@ -260,7 +260,7 @@ class JacksonTokenizerTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLimitTokenized() {
|
||||
void limitTokenized() {
|
||||
|
||||
List<String> source = asList(
|
||||
"[",
|
||||
@@ -297,7 +297,7 @@ class JacksonTokenizerTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16521
|
||||
public void jsonEOFExceptionIsWrappedAsDecodingError() {
|
||||
void jsonEOFExceptionIsWrappedAsDecodingError() {
|
||||
Flux<DataBuffer> source = Flux.just(stringBuffer("{\"status\": \"noClosingQuote}"));
|
||||
Flux<TokenBuffer> tokens = JacksonTokenizer.tokenize(source, this.objectMapper, false, false, -1);
|
||||
|
||||
|
||||
+2
-2
@@ -50,7 +50,7 @@ class CustomizedJackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2Js
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void decode() throws Exception {
|
||||
protected void decode() throws Exception {
|
||||
Flux<DataBuffer> input = Flux.concat(stringBuffer("{\"property\":\"Value1\"}"));
|
||||
|
||||
testDecodeAll(input, MyCustomizedDecoderBean.class, step -> step
|
||||
@@ -60,7 +60,7 @@ class CustomizedJackson2JsonDecoderTests extends AbstractDecoderTests<Jackson2Js
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void decodeToMono() throws Exception {
|
||||
protected void decodeToMono() throws Exception {
|
||||
Mono<DataBuffer> input = stringBuffer("{\"property\":\"Value2\"}");
|
||||
|
||||
ResolvableType elementType = ResolvableType.forClass(MyCustomizedDecoderBean.class);
|
||||
|
||||
+7
-7
@@ -58,13 +58,13 @@ import static org.springframework.http.MediaType.APPLICATION_XML;
|
||||
@SuppressWarnings("removal")
|
||||
class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder> {
|
||||
|
||||
public Jackson2JsonEncoderTests() {
|
||||
Jackson2JsonEncoderTests() {
|
||||
super(new Jackson2JsonEncoder());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
public void canEncode() {
|
||||
protected void canEncode() {
|
||||
ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
|
||||
assertThat(this.encoder.canEncode(pojoType, APPLICATION_JSON)).isTrue();
|
||||
assertThat(this.encoder.canEncode(pojoType, APPLICATION_NDJSON)).isTrue();
|
||||
@@ -87,7 +87,7 @@ class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder>
|
||||
@Override
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void encode() throws Exception {
|
||||
protected void encode() throws Exception {
|
||||
Flux<Object> input = Flux.just(new Pojo("foo", "bar"),
|
||||
new Pojo("foofoo", "barbar"),
|
||||
new Pojo("foofoofoo", "barbarbar"));
|
||||
@@ -101,7 +101,7 @@ class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder>
|
||||
}
|
||||
|
||||
@Test // SPR-15866
|
||||
public void canEncodeWithCustomMimeType() {
|
||||
void canEncodeWithCustomMimeType() {
|
||||
MimeType textJavascript = new MimeType("text", "javascript", StandardCharsets.UTF_8);
|
||||
Jackson2JsonEncoder encoder = new Jackson2JsonEncoder(new ObjectMapper(), textJavascript);
|
||||
|
||||
@@ -174,7 +174,7 @@ class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder>
|
||||
|
||||
|
||||
@Test // SPR-15727
|
||||
public void encodeStreamWithCustomStreamingType() {
|
||||
void encodeStreamWithCustomStreamingType() {
|
||||
MediaType fooMediaType = new MediaType("application", "foo");
|
||||
MediaType barMediaType = new MediaType("application", "bar");
|
||||
this.encoder.setStreamingMediaTypes(Arrays.asList(fooMediaType, barMediaType));
|
||||
@@ -247,7 +247,7 @@ class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder>
|
||||
}
|
||||
|
||||
@Test // gh-28045
|
||||
public void jacksonValueUnwrappedBeforeObjectMapperSelection() {
|
||||
void jacksonValueUnwrappedBeforeObjectMapperSelection() {
|
||||
JacksonViewBean bean = new JacksonViewBean();
|
||||
bean.setWithView1("with");
|
||||
bean.setWithView2("with");
|
||||
@@ -272,7 +272,7 @@ class Jackson2JsonEncoderTests extends AbstractEncoderTests<Jackson2JsonEncoder>
|
||||
}
|
||||
|
||||
@Test // gh-22771
|
||||
public void encodeWithFlushAfterWriteOff() {
|
||||
void encodeWithFlushAfterWriteOff() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(SerializationFeature.FLUSH_AFTER_WRITE_VALUE, false);
|
||||
Jackson2JsonEncoder encoder = new Jackson2JsonEncoder(mapper);
|
||||
|
||||
+3
-3
@@ -252,7 +252,7 @@ class Jackson2TokenizerTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLimit() {
|
||||
void limit() {
|
||||
List<String> source = asList(
|
||||
"[",
|
||||
"{", "\"id\":1,\"name\":\"Dan\"", "},",
|
||||
@@ -273,7 +273,7 @@ class Jackson2TokenizerTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLimitTokenized() {
|
||||
void limitTokenized() {
|
||||
|
||||
List<String> source = asList(
|
||||
"[",
|
||||
@@ -311,7 +311,7 @@ class Jackson2TokenizerTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16521
|
||||
public void jsonEOFExceptionIsWrappedAsDecodingError() {
|
||||
void jsonEOFExceptionIsWrappedAsDecodingError() {
|
||||
Flux<DataBuffer> source = Flux.just(stringBuffer("{\"status\": \"noClosingQuote}"));
|
||||
Flux<TokenBuffer> tokens = Jackson2Tokenizer.tokenize(source, this.jsonFactory, this.objectMapper, false,
|
||||
false, -1);
|
||||
|
||||
+2
-2
@@ -48,14 +48,14 @@ class JacksonCsvEncoderTests extends AbstractEncoderTests<org.springframework.ht
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void canEncode() throws Exception {
|
||||
protected void canEncode() throws Exception {
|
||||
ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
|
||||
assertThat(this.encoder.canEncode(pojoType, JacksonCsvEncoder.TEXT_CSV)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void encode() throws Exception {
|
||||
protected void encode() throws Exception {
|
||||
Flux<Object> input = Flux.just(new Pojo("spring", "framework"),
|
||||
new Pojo("spring", "data"),
|
||||
new Pojo("spring", "boot"));
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ class JacksonJsonDecoderTests extends AbstractDecoderTests<JacksonJsonDecoder> {
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void canDecode() {
|
||||
protected void canDecode() {
|
||||
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), APPLICATION_JSON)).isTrue();
|
||||
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), APPLICATION_NDJSON)).isTrue();
|
||||
assertThat(decoder.canDecode(ResolvableType.forClass(Pojo.class), null)).isTrue();
|
||||
|
||||
+5
-5
@@ -72,7 +72,7 @@ class JacksonJsonEncoderTests extends AbstractEncoderTests<JacksonJsonEncoder> {
|
||||
@Test
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public void canEncode() {
|
||||
protected void canEncode() {
|
||||
ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
|
||||
assertThat(this.encoder.canEncode(pojoType, APPLICATION_JSON)).isTrue();
|
||||
assertThat(this.encoder.canEncode(pojoType, APPLICATION_NDJSON)).isTrue();
|
||||
@@ -97,7 +97,7 @@ class JacksonJsonEncoderTests extends AbstractEncoderTests<JacksonJsonEncoder> {
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void encode() throws Exception {
|
||||
protected void encode() throws Exception {
|
||||
Flux<Object> input = Flux.just(new Pojo("foo", "bar"),
|
||||
new Pojo("foofoo", "barbar"),
|
||||
new Pojo("foofoofoo", "barbarbar"));
|
||||
@@ -111,7 +111,7 @@ class JacksonJsonEncoderTests extends AbstractEncoderTests<JacksonJsonEncoder> {
|
||||
}
|
||||
|
||||
@Test // SPR-15866
|
||||
public void canEncodeWithCustomMimeType() {
|
||||
void canEncodeWithCustomMimeType() {
|
||||
MimeType textJavascript = new MimeType("text", "javascript", StandardCharsets.UTF_8);
|
||||
JacksonJsonEncoder encoder = new JacksonJsonEncoder(new JsonMapper(), textJavascript);
|
||||
|
||||
@@ -181,7 +181,7 @@ class JacksonJsonEncoderTests extends AbstractEncoderTests<JacksonJsonEncoder> {
|
||||
|
||||
|
||||
@Test // SPR-15727
|
||||
public void encodeStreamWithCustomStreamingType() {
|
||||
void encodeStreamWithCustomStreamingType() {
|
||||
MediaType fooMediaType = new MediaType("application", "foo");
|
||||
MediaType barMediaType = new MediaType("application", "bar");
|
||||
this.encoder.setStreamingMediaTypes(Arrays.asList(fooMediaType, barMediaType));
|
||||
@@ -279,7 +279,7 @@ class JacksonJsonEncoderTests extends AbstractEncoderTests<JacksonJsonEncoder> {
|
||||
}
|
||||
|
||||
@Test // gh-22771
|
||||
public void encodeWithFlushAfterWriteOff() {
|
||||
void encodeWithFlushAfterWriteOff() {
|
||||
JsonMapper mapper = JsonMapper.builder().configure(SerializationFeature.FLUSH_AFTER_WRITE_VALUE, false).build();
|
||||
JacksonJsonEncoder encoder = new JacksonJsonEncoder(mapper);
|
||||
|
||||
|
||||
+4
-4
@@ -182,7 +182,7 @@ class MultipartHttpMessageWriterTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test // gh-24582
|
||||
public void writeMultipartRelated() {
|
||||
void writeMultipartRelated() {
|
||||
MediaType mediaType = MediaType.parseMediaType("multipart/related;type=foo");
|
||||
|
||||
MultipartBodyBuilder bodyBuilder = new MultipartBodyBuilder();
|
||||
@@ -215,7 +215,7 @@ class MultipartHttpMessageWriterTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16402
|
||||
public void singleSubscriberWithResource() throws IOException {
|
||||
void singleSubscriberWithResource() throws IOException {
|
||||
Sinks.Many<Resource> sink = Sinks.many().unicast().onBackpressureBuffer();
|
||||
Resource logo = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
|
||||
sink.tryEmitNext(logo);
|
||||
@@ -240,7 +240,7 @@ class MultipartHttpMessageWriterTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16402
|
||||
public void singleSubscriberWithStrings() {
|
||||
void singleSubscriberWithStrings() {
|
||||
AtomicBoolean subscribed = new AtomicBoolean();
|
||||
Flux<String> publisher = Flux.just("foo", "bar", "baz")
|
||||
.doOnSubscribe(subscription ->
|
||||
@@ -259,7 +259,7 @@ class MultipartHttpMessageWriterTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16376
|
||||
public void customContentDisposition() throws IOException {
|
||||
void customContentDisposition() throws IOException {
|
||||
Resource logo = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
|
||||
Flux<DataBuffer> buffers = DataBufferUtils.read(logo, DefaultDataBufferFactory.sharedInstance, 1024);
|
||||
long contentLength = logo.contentLength();
|
||||
|
||||
+6
-6
@@ -67,7 +67,7 @@ class ProtobufDecoderTests extends AbstractDecoderTests<ProtobufDecoder> {
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void canDecode() {
|
||||
protected void canDecode() {
|
||||
assertThat(this.decoder.canDecode(forClass(Msg.class), null)).isTrue();
|
||||
assertThat(this.decoder.canDecode(forClass(Msg.class), MediaType.APPLICATION_PROTOBUF)).isTrue();
|
||||
assertThat(this.decoder.canDecode(forClass(Msg.class), MediaType.parseMediaType("application/vnd.example.public.v1+x-protobuf"))).isTrue();
|
||||
@@ -78,7 +78,7 @@ class ProtobufDecoderTests extends AbstractDecoderTests<ProtobufDecoder> {
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void decodeToMono() {
|
||||
protected void decodeToMono() {
|
||||
Mono<DataBuffer> input = dataBuffer(this.testMsg1);
|
||||
|
||||
testDecodeToMonoAll(input, Msg.class, step -> step
|
||||
@@ -107,7 +107,7 @@ class ProtobufDecoderTests extends AbstractDecoderTests<ProtobufDecoder> {
|
||||
@Test
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void decode() {
|
||||
protected void decode() {
|
||||
Flux<DataBuffer> input = Flux.just(this.testMsg1, this.testMsg2)
|
||||
.flatMap(msg -> Mono.defer(() -> {
|
||||
DataBuffer buffer = this.bufferFactory.allocateBuffer();
|
||||
@@ -129,7 +129,7 @@ class ProtobufDecoderTests extends AbstractDecoderTests<ProtobufDecoder> {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void decodeSplitChunks() {
|
||||
void decodeSplitChunks() {
|
||||
Flux<DataBuffer> input = Flux.just(this.testMsg1, this.testMsg2)
|
||||
.flatMap(msg -> Mono.defer(() -> {
|
||||
DataBuffer buffer = this.bufferFactory.allocateBuffer();
|
||||
@@ -161,7 +161,7 @@ class ProtobufDecoderTests extends AbstractDecoderTests<ProtobufDecoder> {
|
||||
|
||||
@Test // SPR-17429
|
||||
@SuppressWarnings("deprecation")
|
||||
public void decodeSplitMessageSize() {
|
||||
void decodeSplitMessageSize() {
|
||||
this.decoder.setMaxMessageSize(100009);
|
||||
Msg bigMessage = Msg.newBuilder().setFoo("azertyuiop".repeat(10000))
|
||||
.setBlah(secondMsg2).build();
|
||||
@@ -197,7 +197,7 @@ class ProtobufDecoderTests extends AbstractDecoderTests<ProtobufDecoder> {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void decodeMergedChunks() throws IOException {
|
||||
void decodeMergedChunks() throws IOException {
|
||||
DataBuffer buffer = this.bufferFactory.allocateBuffer();
|
||||
this.testMsg1.writeDelimitedTo(buffer.asOutputStream());
|
||||
this.testMsg1.writeDelimitedTo(buffer.asOutputStream());
|
||||
|
||||
+1
-1
@@ -236,7 +236,7 @@ class ClientCodecConfigurerTests {
|
||||
}
|
||||
|
||||
@Test // gh-24194
|
||||
public void cloneShouldNotDropMultipartCodecs() {
|
||||
void cloneShouldNotDropMultipartCodecs() {
|
||||
|
||||
ClientCodecConfigurer clone = this.configurer.clone();
|
||||
List<HttpMessageWriter<?>> writers =
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ class JacksonXmlEncoderTests extends AbstractLeakCheckingTests {
|
||||
|
||||
|
||||
@Test
|
||||
protected void canEncode() {
|
||||
void canEncode() {
|
||||
ResolvableType pojoType = ResolvableType.forClass(Pojo.class);
|
||||
assertThat(this.encoder.canEncode(pojoType, MediaType.APPLICATION_XML)).isTrue();
|
||||
assertThat(this.encoder.canEncode(pojoType, MediaType.TEXT_XML)).isTrue();
|
||||
@@ -58,7 +58,7 @@ class JacksonXmlEncoderTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
protected void encode() {
|
||||
void encode() {
|
||||
Pojo value = new Pojo("foo", "bar");
|
||||
DataBuffer result = encoder.encodeValue(value, this.bufferFactory, ResolvableType.forClass(Pojo.class),
|
||||
MediaType.APPLICATION_XML, null);
|
||||
|
||||
+1
-1
@@ -231,7 +231,7 @@ class Jaxb2XmlDecoderTests extends AbstractLeakCheckingTests {
|
||||
}
|
||||
|
||||
@Test // gh-24622
|
||||
public void decodeErrorWithXmlNotWellFormed() {
|
||||
void decodeErrorWithXmlNotWellFormed() {
|
||||
Mono<DataBuffer> source = toDataBufferMono("<Response><tag>something</tag</Response>");
|
||||
Mono<Object> result = this.decoder.decodeToMono(source, ResolvableType.forClass(Pojo.class), null, HINTS);
|
||||
|
||||
|
||||
+1
-1
@@ -338,7 +338,7 @@ class FormHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13309
|
||||
public void writeMultipartOrder() throws Exception {
|
||||
void writeMultipartOrder() throws Exception {
|
||||
MyBean myBean = new MyBean();
|
||||
myBean.setString("foo");
|
||||
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ class ObjectToStringHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testConversionServiceRequired() {
|
||||
void conversionServiceRequired() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
new ObjectToStringHttpMessageConverter(null));
|
||||
}
|
||||
|
||||
+7
-7
@@ -89,7 +89,7 @@ class ResourceHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13443
|
||||
public void shouldReadInputStreamResource() throws IOException {
|
||||
void shouldReadInputStreamResource() throws IOException {
|
||||
try (InputStream body = getClass().getResourceAsStream("logo.jpg") ) {
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body);
|
||||
inputMessage.getHeaders().setContentType(MediaType.IMAGE_JPEG);
|
||||
@@ -105,7 +105,7 @@ class ResourceHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-14882
|
||||
public void shouldNotReadInputStreamResource() throws IOException {
|
||||
void shouldNotReadInputStreamResource() throws IOException {
|
||||
ResourceHttpMessageConverter noStreamConverter = new ResourceHttpMessageConverter(false);
|
||||
try (InputStream body = getClass().getResourceAsStream("logo.jpg") ) {
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body);
|
||||
@@ -116,7 +116,7 @@ class ResourceHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // gh-36368
|
||||
public void shouldNotReadStreamResourceAsUnknownType() throws IOException {
|
||||
void shouldNotReadStreamResourceAsUnknownType() throws IOException {
|
||||
try (InputStream body = getClass().getResourceAsStream("logo.jpg") ) {
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body);
|
||||
inputMessage.getHeaders().setContentType(MediaType.IMAGE_JPEG);
|
||||
@@ -138,7 +138,7 @@ class ResourceHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-10848
|
||||
public void writeByteArrayNullMediaType() throws IOException {
|
||||
void writeByteArrayNullMediaType() throws IOException {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
byte[] byteArray = {1, 2, 3};
|
||||
Resource body = new ByteArrayResource(byteArray);
|
||||
@@ -148,7 +148,7 @@ class ResourceHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12999
|
||||
public void writeContentNotGettingInputStream() throws Exception {
|
||||
void writeContentNotGettingInputStream() throws Exception {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
Resource resource = mock();
|
||||
given(resource.getInputStream()).willThrow(FileNotFoundException.class);
|
||||
@@ -158,7 +158,7 @@ class ResourceHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12999
|
||||
public void writeContentNotClosingInputStream() throws Exception {
|
||||
void writeContentNotClosingInputStream() throws Exception {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
Resource resource = mock();
|
||||
InputStream inputStream = mock();
|
||||
@@ -171,7 +171,7 @@ class ResourceHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13620
|
||||
public void writeContentInputStreamThrowingNullPointerException() throws Exception {
|
||||
void writeContentInputStreamThrowingNullPointerException() throws Exception {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
Resource resource = mock();
|
||||
InputStream in = mock();
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@ class ResourceRegionHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-15041
|
||||
public void applicationOctetStreamDefaultContentType() throws Exception {
|
||||
void applicationOctetStreamDefaultContentType() throws Exception {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
ClassPathResource body = mock();
|
||||
given(body.getFilename()).willReturn("spring.dat");
|
||||
|
||||
+4
-4
@@ -87,7 +87,7 @@ class GsonHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readUntyped() throws IOException {
|
||||
void readUntyped() throws IOException {
|
||||
String body = "{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||
"\"number\":42,\"string\":\"Foo\",\"bool\":true,\"fraction\":42.0}";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(StandardCharsets.UTF_8));
|
||||
@@ -179,7 +179,7 @@ class GsonHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readAndWriteGenerics() throws Exception {
|
||||
void readAndWriteGenerics() throws Exception {
|
||||
Field beansList = ListHolder.class.getField("listField");
|
||||
|
||||
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||
@@ -206,7 +206,7 @@ class GsonHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readAndWriteParameterizedType() throws Exception {
|
||||
void readAndWriteParameterizedType() throws Exception {
|
||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {
|
||||
};
|
||||
|
||||
@@ -233,7 +233,7 @@ class GsonHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void writeParameterizedBaseType() throws Exception {
|
||||
void writeParameterizedBaseType() throws Exception {
|
||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<>() {};
|
||||
|
||||
|
||||
+1
-1
@@ -345,7 +345,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
||||
}
|
||||
|
||||
@Test // SPR-14435
|
||||
public void setFactory() {
|
||||
void setFactory() {
|
||||
this.factory.setFactory(new SmileFactory());
|
||||
this.factory.afterPropertiesSet();
|
||||
|
||||
|
||||
+4
-4
@@ -87,7 +87,7 @@ class JsonbHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readUntyped() throws IOException {
|
||||
void readUntyped() throws IOException {
|
||||
String body = "{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||
"\"number\":42,\"string\":\"Foo\",\"bool\":true,\"fraction\":42.0}";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(StandardCharsets.UTF_8));
|
||||
@@ -179,7 +179,7 @@ class JsonbHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readAndWriteGenerics() throws Exception {
|
||||
void readAndWriteGenerics() throws Exception {
|
||||
Field beansList = ListHolder.class.getField("listField");
|
||||
|
||||
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||
@@ -206,7 +206,7 @@ class JsonbHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readAndWriteParameterizedType() throws Exception {
|
||||
void readAndWriteParameterizedType() throws Exception {
|
||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||
|
||||
String body = "[{\"bytes\":[1,2],\"array\":[\"Foo\",\"Bar\"]," +
|
||||
@@ -232,7 +232,7 @@ class JsonbHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void writeParameterizedBaseType() throws Exception {
|
||||
void writeParameterizedBaseType() throws Exception {
|
||||
ParameterizedTypeReference<List<MyBean>> beansList = new ParameterizedTypeReference<>() {};
|
||||
ParameterizedTypeReference<List<MyBase>> baseList = new ParameterizedTypeReference<>() {};
|
||||
|
||||
|
||||
+8
-8
@@ -80,7 +80,7 @@ class Jaxb2CollectionHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readXmlRootElementList() throws Exception {
|
||||
void readXmlRootElementList() throws Exception {
|
||||
String content = "<list><rootElement><type s=\"1\"/></rootElement><rootElement><type s=\"2\"/></rootElement></list>";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(content.getBytes(StandardCharsets.UTF_8));
|
||||
List<RootElement> result = (List<RootElement>) converter.read(rootElementListType, null, inputMessage);
|
||||
@@ -92,7 +92,7 @@ class Jaxb2CollectionHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readXmlRootElementSet() throws Exception {
|
||||
void readXmlRootElementSet() throws Exception {
|
||||
String content = "<set><rootElement><type s=\"1\"/></rootElement><rootElement><type s=\"2\"/></rootElement></set>";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(content.getBytes(StandardCharsets.UTF_8));
|
||||
Set<RootElement> result = (Set<RootElement>) converter.read(rootElementSetType, null, inputMessage);
|
||||
@@ -104,7 +104,7 @@ class Jaxb2CollectionHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readXmlTypeList() throws Exception {
|
||||
void readXmlTypeList() throws Exception {
|
||||
String content = "<list><foo s=\"1\"/><bar s=\"2\"/></list>";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(content.getBytes(StandardCharsets.UTF_8));
|
||||
List<TestType> result = (List<TestType>) converter.read(typeListType, null, inputMessage);
|
||||
@@ -116,7 +116,7 @@ class Jaxb2CollectionHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readXmlTypeSet() throws Exception {
|
||||
void readXmlTypeSet() throws Exception {
|
||||
String content = "<set><foo s=\"1\"/><bar s=\"2\"/></set>";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(content.getBytes(StandardCharsets.UTF_8));
|
||||
Set<TestType> result = (Set<TestType>) converter.read(typeSetType, null, inputMessage);
|
||||
@@ -128,7 +128,7 @@ class Jaxb2CollectionHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readXmlRootElementExternalEntityDisabled() throws Exception {
|
||||
void readXmlRootElementExternalEntityDisabled() throws Exception {
|
||||
Resource external = new ClassPathResource("external.txt", getClass());
|
||||
String content = "<!DOCTYPE root [" +
|
||||
" <!ELEMENT external ANY >\n" +
|
||||
@@ -157,7 +157,7 @@ class Jaxb2CollectionHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readXmlRootElementExternalEntityEnabled() throws Exception {
|
||||
void readXmlRootElementExternalEntityEnabled() throws Exception {
|
||||
Resource external = new ClassPathResource("external.txt", getClass());
|
||||
String content = "<!DOCTYPE root [" +
|
||||
" <!ELEMENT external ANY >\n" +
|
||||
@@ -180,7 +180,7 @@ class Jaxb2CollectionHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testXmlBomb() {
|
||||
void xmlBomb() {
|
||||
// https://en.wikipedia.org/wiki/Billion_laughs
|
||||
// https://msdn.microsoft.com/en-us/magazine/ee335713.aspx
|
||||
String content = """
|
||||
@@ -207,7 +207,7 @@ class Jaxb2CollectionHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void readXmlRootElementListHeaderCharset() throws Exception {
|
||||
void readXmlRootElementListHeaderCharset() throws Exception {
|
||||
String content = "<list><rootElement><type s=\"Hellø Wørld\"/></rootElement></list>";
|
||||
MockHttpInputMessage inputMessage = new MockHttpInputMessage(content.getBytes(StandardCharsets.ISO_8859_1));
|
||||
inputMessage.getHeaders().setContentType(MediaType.parseMediaType("application/xml;charset=iso-8859-1"));
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ class Jaxb2RootElementHttpMessageConverterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testXmlBomb() throws Exception {
|
||||
void xmlBomb() throws Exception {
|
||||
// https://en.wikipedia.org/wiki/Billion_laughs
|
||||
// https://msdn.microsoft.com/en-us/magazine/ee335713.aspx
|
||||
String content = """
|
||||
|
||||
+9
-9
@@ -119,25 +119,25 @@ class DefaultPathContainerTests {
|
||||
@Test
|
||||
void path() {
|
||||
// basic
|
||||
testPath("/a/b/c", "/a/b/c", "/", "a", "/", "b", "/", "c");
|
||||
path("/a/b/c", "/a/b/c", "/", "a", "/", "b", "/", "c");
|
||||
|
||||
// root path
|
||||
testPath("/", "/", "/");
|
||||
path("/", "/", "/");
|
||||
|
||||
// empty path
|
||||
testPath("", "");
|
||||
testPath("%20%20", "%20%20", "%20%20");
|
||||
path("", "");
|
||||
path("%20%20", "%20%20", "%20%20");
|
||||
|
||||
// trailing slash
|
||||
testPath("/a/b/", "/a/b/", "/", "a", "/", "b", "/");
|
||||
testPath("/a/b//", "/a/b//", "/", "a", "/", "b", "/", "/");
|
||||
path("/a/b/", "/a/b/", "/", "a", "/", "b", "/");
|
||||
path("/a/b//", "/a/b//", "/", "a", "/", "b", "/", "/");
|
||||
|
||||
// extra slashes and spaces
|
||||
testPath("/%20", "/%20", "/", "%20");
|
||||
testPath("//%20/%20", "//%20/%20", "/", "/", "%20", "/", "%20");
|
||||
path("/%20", "/%20", "/", "%20");
|
||||
path("//%20/%20", "//%20/%20", "/", "/", "%20", "/", "%20");
|
||||
}
|
||||
|
||||
private void testPath(String input, String value, String... expectedElements) {
|
||||
private void path(String input, String value, String... expectedElements) {
|
||||
PathContainer path = PathContainer.parsePath(input, Options.HTTP_PATH);
|
||||
|
||||
assertThat(path.value()).as("value: '" + input + "'").isEqualTo(value);
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ class ContextPathCompositeHandlerTests {
|
||||
}
|
||||
|
||||
@Test // SPR-17144
|
||||
public void notFoundWithCommitAction() {
|
||||
void notFoundWithCommitAction() {
|
||||
|
||||
AtomicBoolean commitInvoked = new AtomicBoolean();
|
||||
|
||||
|
||||
+2
-2
@@ -56,7 +56,7 @@ class ListenerReadPublisherTests {
|
||||
}
|
||||
|
||||
@Test // SPR-17410
|
||||
public void discardDataOnError() {
|
||||
void discardDataOnError() {
|
||||
|
||||
this.subscriber.getSubscription().request(2);
|
||||
this.publisher.onDataAvailable();
|
||||
@@ -67,7 +67,7 @@ class ListenerReadPublisherTests {
|
||||
}
|
||||
|
||||
@Test // SPR-17410
|
||||
public void discardDataOnCancel() {
|
||||
void discardDataOnCancel() {
|
||||
|
||||
this.subscriber.getSubscription().request(2);
|
||||
this.subscriber.setCancelOnNext(true);
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ class ListenerWriteProcessorTests {
|
||||
|
||||
|
||||
@Test // SPR-17410
|
||||
public void writePublisherError() {
|
||||
void writePublisherError() {
|
||||
|
||||
// Turn off writing so next item will be cached
|
||||
this.processor.setWritePossible(false);
|
||||
@@ -68,7 +68,7 @@ class ListenerWriteProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-17410
|
||||
public void ioExceptionDuringWrite() {
|
||||
void ioExceptionDuringWrite() {
|
||||
|
||||
// Fail on next write
|
||||
this.processor.setWritePossible(true);
|
||||
@@ -83,7 +83,7 @@ class ListenerWriteProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-17410
|
||||
public void onNextWithoutDemand() {
|
||||
void onNextWithoutDemand() {
|
||||
|
||||
// Disable writing: next item will be cached.
|
||||
this.processor.setWritePossible(false);
|
||||
|
||||
+3
-3
@@ -72,7 +72,7 @@ class ServerHttpRequestTests {
|
||||
}
|
||||
|
||||
@Test // SPR-15140
|
||||
public void queryParamsWithEncodedValue() throws Exception {
|
||||
void queryParamsWithEncodedValue() throws Exception {
|
||||
MultiValueMap<String, String> params = createRequest("/path?a=%20%2B+%C3%A0").getQueryParams();
|
||||
assertThat(params).hasSize(1);
|
||||
assertThat(params.get("a")).isEqualTo(Collections.singletonList(" + \u00e0"));
|
||||
@@ -121,7 +121,7 @@ class ServerHttpRequestTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16434
|
||||
public void mutatePathWithEncodedQueryParams() throws Exception {
|
||||
void mutatePathWithEncodedQueryParams() throws Exception {
|
||||
ServerHttpRequest request = createRequest("/path?name=%E6%89%8E%E6%A0%B9");
|
||||
request = request.mutate().path("/mutatedPath").build();
|
||||
|
||||
@@ -204,7 +204,7 @@ class ServerHttpRequestTests {
|
||||
}
|
||||
|
||||
@Test // gh-26304
|
||||
public void mutateDoesNotPreventAccessToNativeRequest() throws Exception {
|
||||
void mutateDoesNotPreventAccessToNativeRequest() throws Exception {
|
||||
ServerHttpRequest request = createRequest("/path");
|
||||
request = request.mutate().header("key", "value").build();
|
||||
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ class MappingMediaTypeFileExtensionResolverTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13747
|
||||
public void lookupMediaTypeCaseInsensitive() {
|
||||
void lookupMediaTypeCaseInsensitive() {
|
||||
assertThat(new MappingMediaTypeFileExtensionResolver(DEFAULT_MAPPINGS).lookupMediaType("JSON"))
|
||||
.isEqualTo(MediaType.APPLICATION_JSON);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class EscapedErrorsTests {
|
||||
|
||||
@Test
|
||||
void testEscapedErrors() {
|
||||
void escapedErrors() {
|
||||
TestBean tb = new TestBean();
|
||||
tb.setName("empty &");
|
||||
|
||||
|
||||
+12
-12
@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class ServletRequestDataBinderTests {
|
||||
|
||||
@Test
|
||||
void testBindingWithNestedObjectCreation() {
|
||||
void bindingWithNestedObjectCreation() {
|
||||
TestBean tb = new TestBean();
|
||||
|
||||
ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "person");
|
||||
@@ -61,7 +61,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldPrefixCausesFieldReset() {
|
||||
void fieldPrefixCausesFieldReset() {
|
||||
TestBean target = new TestBean();
|
||||
ServletRequestDataBinder binder = new ServletRequestDataBinder(target);
|
||||
|
||||
@@ -77,7 +77,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldPrefixCausesFieldResetWithIgnoreUnknownFields() {
|
||||
void fieldPrefixCausesFieldResetWithIgnoreUnknownFields() {
|
||||
TestBean target = new TestBean();
|
||||
ServletRequestDataBinder binder = new ServletRequestDataBinder(target);
|
||||
binder.setIgnoreUnknownFields(false);
|
||||
@@ -94,7 +94,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefault() {
|
||||
void fieldDefault() {
|
||||
TestBean target = new TestBean();
|
||||
ServletRequestDataBinder binder = new ServletRequestDataBinder(target);
|
||||
|
||||
@@ -110,7 +110,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefaultPreemptsFieldMarker() {
|
||||
void fieldDefaultPreemptsFieldMarker() {
|
||||
TestBean target = new TestBean();
|
||||
ServletRequestDataBinder binder = new ServletRequestDataBinder(target);
|
||||
|
||||
@@ -131,7 +131,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefaultNonBoolean() {
|
||||
void fieldDefaultNonBoolean() {
|
||||
TestBean target = new TestBean();
|
||||
ServletRequestDataBinder binder = new ServletRequestDataBinder(target);
|
||||
|
||||
@@ -147,7 +147,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWithCommaSeparatedStringArray() {
|
||||
void withCommaSeparatedStringArray() {
|
||||
TestBean target = new TestBean();
|
||||
ServletRequestDataBinder binder = new ServletRequestDataBinder(target);
|
||||
|
||||
@@ -165,7 +165,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBindingWithNestedObjectCreationAndWrongOrder() {
|
||||
void bindingWithNestedObjectCreationAndWrongOrder() {
|
||||
TestBean tb = new TestBean();
|
||||
|
||||
ServletRequestDataBinder binder = new ServletRequestDataBinder(tb, "person");
|
||||
@@ -186,7 +186,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNoPrefix() {
|
||||
void noPrefix() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.addParameter("forname", "Tony");
|
||||
request.addParameter("surname", "Blair");
|
||||
@@ -197,7 +197,7 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPrefix() {
|
||||
void prefix() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.addParameter("test_forname", "Tony");
|
||||
request.addParameter("test_surname", "Blair");
|
||||
@@ -213,14 +213,14 @@ class ServletRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNoParameters() {
|
||||
void noParameters() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(request);
|
||||
assertThat(pvs.getPropertyValues().length).as("Found no parameters").isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMultipleValuesForParameter() {
|
||||
void multipleValuesForParameter() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
String[] original = new String[] {"Tony", "Rod"};
|
||||
request.addParameter("forname", original);
|
||||
|
||||
+11
-11
@@ -34,7 +34,7 @@ class ServletRequestUtilsTests {
|
||||
|
||||
|
||||
@Test
|
||||
void testIntParameter() throws ServletRequestBindingException {
|
||||
void intParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "5");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("paramEmpty", "");
|
||||
@@ -57,7 +57,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testIntParameters() throws ServletRequestBindingException {
|
||||
void intParameters() throws ServletRequestBindingException {
|
||||
request.addParameter("param", "1", "2", "3");
|
||||
|
||||
request.addParameter("param2", "1");
|
||||
@@ -76,7 +76,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLongParameter() throws ServletRequestBindingException {
|
||||
void longParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "5");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("paramEmpty", "");
|
||||
@@ -99,7 +99,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testLongParameters() throws ServletRequestBindingException {
|
||||
void longParameters() throws ServletRequestBindingException {
|
||||
request.setParameter("param", "1", "2", "3");
|
||||
|
||||
request.setParameter("param2", "0");
|
||||
@@ -123,7 +123,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFloatParameter() throws ServletRequestBindingException {
|
||||
void floatParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "5.5");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("paramEmpty", "");
|
||||
@@ -146,7 +146,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFloatParameters() throws ServletRequestBindingException {
|
||||
void floatParameters() throws ServletRequestBindingException {
|
||||
request.addParameter("param", "1.5", "2.5", "3");
|
||||
|
||||
request.addParameter("param2", "1.5");
|
||||
@@ -161,7 +161,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDoubleParameter() throws ServletRequestBindingException {
|
||||
void doubleParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "5.5");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("paramEmpty", "");
|
||||
@@ -184,7 +184,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDoubleParameters() throws ServletRequestBindingException {
|
||||
void doubleParameters() throws ServletRequestBindingException {
|
||||
request.addParameter("param", "1.5", "2.5", "3");
|
||||
|
||||
request.addParameter("param2", "1.5");
|
||||
@@ -198,7 +198,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBooleanParameter() throws ServletRequestBindingException {
|
||||
void booleanParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "true");
|
||||
request.addParameter("param2", "e");
|
||||
request.addParameter("param4", "yes");
|
||||
@@ -226,7 +226,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBooleanParameters() throws ServletRequestBindingException {
|
||||
void booleanParameters() throws ServletRequestBindingException {
|
||||
request.addParameter("param", "true", "yes", "off", "1", "bogus");
|
||||
|
||||
request.addParameter("param2", "false");
|
||||
@@ -249,7 +249,7 @@ class ServletRequestUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testStringParameter() throws ServletRequestBindingException {
|
||||
void stringParameter() throws ServletRequestBindingException {
|
||||
request.addParameter("param1", "str");
|
||||
request.addParameter("paramEmpty", "");
|
||||
|
||||
|
||||
+12
-12
@@ -68,7 +68,7 @@ class WebExchangeDataBinderTests {
|
||||
|
||||
|
||||
@Test
|
||||
void testBindingWithNestedObjectCreation() {
|
||||
void bindingWithNestedObjectCreation() {
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
formData.add("spouse", "someValue");
|
||||
formData.add("spouse.name", "test");
|
||||
@@ -79,7 +79,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldPrefixCausesFieldReset() {
|
||||
void fieldPrefixCausesFieldReset() {
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
formData.add("_postProcessed", "visible");
|
||||
formData.add("postProcessed", "on");
|
||||
@@ -92,7 +92,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldPrefixCausesFieldResetWithIgnoreUnknownFields() {
|
||||
void fieldPrefixCausesFieldResetWithIgnoreUnknownFields() {
|
||||
this.binder.setIgnoreUnknownFields(false);
|
||||
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
@@ -107,7 +107,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test // gh-25836
|
||||
public void testFieldWithEmptyArrayIndex() {
|
||||
void fieldWithEmptyArrayIndex() {
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
formData.add("stringArray[]", "ONE");
|
||||
formData.add("stringArray[]", "TWO");
|
||||
@@ -116,7 +116,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefault() {
|
||||
void fieldDefault() {
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
formData.add("!postProcessed", "off");
|
||||
formData.add("postProcessed", "on");
|
||||
@@ -129,7 +129,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefaultPreemptsFieldMarker() {
|
||||
void fieldDefaultPreemptsFieldMarker() {
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
formData.add("!postProcessed", "on");
|
||||
formData.add("_postProcessed", "visible");
|
||||
@@ -147,7 +147,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefaultNonBoolean() {
|
||||
void fieldDefaultNonBoolean() {
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
formData.add("!name", "anonymous");
|
||||
formData.add("name", "Scott");
|
||||
@@ -160,7 +160,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWithCommaSeparatedStringArray() {
|
||||
void withCommaSeparatedStringArray() {
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
formData.add("stringArray", "bar");
|
||||
formData.add("stringArray", "abc");
|
||||
@@ -175,7 +175,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBindingWithNestedObjectCreationAndWrongOrder() {
|
||||
void bindingWithNestedObjectCreationAndWrongOrder() {
|
||||
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
||||
formData.add("spouse.name", "test");
|
||||
formData.add("spouse", "someValue");
|
||||
@@ -186,7 +186,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBindingWithQueryParams() {
|
||||
void bindingWithQueryParams() {
|
||||
String url = "/path?spouse=someValue&spouse.name=test";
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.post(url));
|
||||
this.binder.bind(exchange).block(Duration.ofSeconds(5));
|
||||
@@ -196,7 +196,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMultipart() {
|
||||
void multipart() {
|
||||
|
||||
MultipartBean bean = new MultipartBean();
|
||||
WebExchangeDataBinder binder = new WebExchangeDataBinder(bean);
|
||||
@@ -222,7 +222,7 @@ class WebExchangeDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMultipartDataClass() {
|
||||
void multipartDataClass() {
|
||||
WebExchangeDataBinder binder = new WebExchangeDataBinder(null);
|
||||
binder.setTargetType(ResolvableType.forClass(MultipartDataClass.class));
|
||||
|
||||
|
||||
+20
-20
@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class WebRequestDataBinderTests {
|
||||
|
||||
@Test
|
||||
void testBindingWithNestedObjectCreation() {
|
||||
void bindingWithNestedObjectCreation() {
|
||||
TestBean tb = new TestBean();
|
||||
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(tb, "person");
|
||||
@@ -65,7 +65,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBindingWithNestedObjectCreationThroughAutoGrow() {
|
||||
void bindingWithNestedObjectCreationThroughAutoGrow() {
|
||||
TestBean tb = new TestBeanWithConcreteSpouse();
|
||||
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(tb, "person");
|
||||
@@ -80,7 +80,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldPrefixCausesFieldReset() {
|
||||
void fieldPrefixCausesFieldReset() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
|
||||
@@ -96,7 +96,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldPrefixCausesFieldResetWithIgnoreUnknownFields() {
|
||||
void fieldPrefixCausesFieldResetWithIgnoreUnknownFields() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
binder.setIgnoreUnknownFields(false);
|
||||
@@ -113,7 +113,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test // gh-25836
|
||||
public void testFieldWithEmptyArrayIndex() {
|
||||
void fieldWithEmptyArrayIndex() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
|
||||
@@ -125,7 +125,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefault() {
|
||||
void fieldDefault() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
|
||||
@@ -142,7 +142,7 @@ class WebRequestDataBinderTests {
|
||||
|
||||
// SPR-13502
|
||||
@Test
|
||||
void testCollectionFieldsDefault() {
|
||||
void collectionFieldsDefault() {
|
||||
TestBean target = new TestBean();
|
||||
target.setSomeSet(null);
|
||||
target.setSomeList(null);
|
||||
@@ -161,7 +161,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefaultPreemptsFieldMarker() {
|
||||
void fieldDefaultPreemptsFieldMarker() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
|
||||
@@ -182,7 +182,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefaultWithNestedProperty() {
|
||||
void fieldDefaultWithNestedProperty() {
|
||||
TestBean target = new TestBean();
|
||||
target.setSpouse(new TestBean());
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
@@ -204,7 +204,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFieldDefaultNonBoolean() {
|
||||
void fieldDefaultNonBoolean() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
|
||||
@@ -220,7 +220,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWithCommaSeparatedStringArray() {
|
||||
void withCommaSeparatedStringArray() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
|
||||
@@ -238,7 +238,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testEnumBinding() {
|
||||
void enumBinding() {
|
||||
EnumHolder target = new EnumHolder();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
|
||||
@@ -249,7 +249,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMultipartFileAsString() {
|
||||
void multipartFileAsString() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
binder.registerCustomEditor(String.class, new StringMultipartFileEditor());
|
||||
@@ -261,7 +261,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMultipartFileAsStringArray() {
|
||||
void multipartFileAsStringArray() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
binder.registerCustomEditor(String.class, new StringMultipartFileEditor());
|
||||
@@ -274,7 +274,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMultipartFilesAsStringArray() {
|
||||
void multipartFilesAsStringArray() {
|
||||
TestBean target = new TestBean();
|
||||
WebRequestDataBinder binder = new WebRequestDataBinder(target);
|
||||
binder.registerCustomEditor(String.class, new StringMultipartFileEditor());
|
||||
@@ -289,7 +289,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNoPrefix() {
|
||||
void noPrefix() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.addParameter("forname", "Tony");
|
||||
request.addParameter("surname", "Blair");
|
||||
@@ -300,7 +300,7 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPrefix() {
|
||||
void prefix() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.addParameter("test_forname", "Tony");
|
||||
request.addParameter("test_surname", "Blair");
|
||||
@@ -318,7 +318,7 @@ class WebRequestDataBinderTests {
|
||||
/**
|
||||
* Must contain: forname=Tony surname=Blair age=50
|
||||
*/
|
||||
protected void doTestTony(PropertyValues pvs) {
|
||||
void doTestTony(PropertyValues pvs) {
|
||||
assertThat(pvs.getPropertyValues().length).as("Contains 3").isEqualTo(3);
|
||||
assertThat(pvs.contains("forname")).as("Contains forname").isTrue();
|
||||
assertThat(pvs.contains("surname")).as("Contains surname").isTrue();
|
||||
@@ -343,14 +343,14 @@ class WebRequestDataBinderTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNoParameters() {
|
||||
void noParameters() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
ServletRequestParameterPropertyValues pvs = new ServletRequestParameterPropertyValues(request);
|
||||
assertThat(pvs.getPropertyValues().length).as("Found no parameters").isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMultipleValuesForParameter() {
|
||||
void multipleValuesForParameter() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
String[] original = new String[] {"Tony", "Rod"};
|
||||
request.addParameter("forname", original);
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class HttpStatusCodeExceptionTests {
|
||||
* serializable due to the addition of a non-serializable {@code Charset} field.
|
||||
*/
|
||||
@Test
|
||||
void testSerializability() throws IOException, ClassNotFoundException {
|
||||
void serializability() throws IOException, ClassNotFoundException {
|
||||
HttpStatusCodeException ex1 = new HttpClientErrorException(
|
||||
HttpStatus.BAD_REQUEST, null, null, StandardCharsets.US_ASCII);
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
class RequestAndSessionScopedBeanTests {
|
||||
|
||||
@Test
|
||||
void testPutBeanInRequest() {
|
||||
void putBeanInRequest() {
|
||||
String targetBeanName = "target";
|
||||
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
@@ -70,7 +70,7 @@ class RequestAndSessionScopedBeanTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutBeanInSession() {
|
||||
void putBeanInSession() {
|
||||
String targetBeanName = "target";
|
||||
HttpServletRequest request = new MockHttpServletRequest();
|
||||
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
|
||||
|
||||
+6
-6
@@ -55,7 +55,7 @@ class RequestScopedProxyTests {
|
||||
|
||||
|
||||
@Test
|
||||
void testGetFromScope() {
|
||||
void getFromScope() {
|
||||
String name = "requestScopedObject";
|
||||
TestBean bean = (TestBean) this.beanFactory.getBean(name);
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
@@ -80,7 +80,7 @@ class RequestScopedProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetFromScopeThroughDynamicProxy() {
|
||||
void getFromScopeThroughDynamicProxy() {
|
||||
String name = "requestScopedProxy";
|
||||
ITestBean bean = (ITestBean) this.beanFactory.getBean(name);
|
||||
// assertTrue(AopUtils.isJdkDynamicProxy(bean));
|
||||
@@ -105,7 +105,7 @@ class RequestScopedProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDestructionAtRequestCompletion() {
|
||||
void destructionAtRequestCompletion() {
|
||||
String name = "requestScopedDisposableObject";
|
||||
DerivedTestBean bean = (DerivedTestBean) this.beanFactory.getBean(name);
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
@@ -131,7 +131,7 @@ class RequestScopedProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetFromFactoryBeanInScope() {
|
||||
void getFromFactoryBeanInScope() {
|
||||
String name = "requestScopedFactoryBean";
|
||||
TestBean bean = (TestBean) this.beanFactory.getBean(name);
|
||||
assertThat(AopUtils.isCglibProxy(bean)).isTrue();
|
||||
@@ -153,7 +153,7 @@ class RequestScopedProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetInnerBeanFromScope() {
|
||||
void getInnerBeanFromScope() {
|
||||
TestBean bean = (TestBean) this.beanFactory.getBean("outerBean");
|
||||
assertThat(AopUtils.isAopProxy(bean)).isFalse();
|
||||
assertThat(AopUtils.isCglibProxy(bean.getSpouse())).isTrue();
|
||||
@@ -177,7 +177,7 @@ class RequestScopedProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetAnonymousInnerBeanFromScope() {
|
||||
void getAnonymousInnerBeanFromScope() {
|
||||
TestBean bean = (TestBean) this.beanFactory.getBean("outerBean");
|
||||
assertThat(AopUtils.isAopProxy(bean)).isFalse();
|
||||
assertThat(AopUtils.isCglibProxy(bean.getSpouse())).isTrue();
|
||||
|
||||
+3
-3
@@ -49,7 +49,7 @@ class WebApplicationContextScopeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testRequestScope() {
|
||||
void requestScope() {
|
||||
WebApplicationContext ac = initApplicationContext(WebApplicationContext.SCOPE_REQUEST);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
ServletRequestAttributes requestAttributes = new ServletRequestAttributes(request);
|
||||
@@ -68,7 +68,7 @@ class WebApplicationContextScopeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testSessionScope() {
|
||||
void sessionScope() {
|
||||
WebApplicationContext ac = initApplicationContext(WebApplicationContext.SCOPE_SESSION);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
ServletRequestAttributes requestAttributes = new ServletRequestAttributes(request);
|
||||
@@ -87,7 +87,7 @@ class WebApplicationContextScopeTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testApplicationScope() {
|
||||
void applicationScope() {
|
||||
WebApplicationContext ac = initApplicationContext(WebApplicationContext.SCOPE_APPLICATION);
|
||||
assertThat(ac.getServletContext().getAttribute(NAME)).isNull();
|
||||
DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class);
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ class WebAsyncManagerTimeoutTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void startCallableProcessingTimeoutAndCheckThreadInterrupted() throws Exception {
|
||||
void startCallableProcessingTimeoutAndCheckThreadInterrupted() throws Exception {
|
||||
|
||||
StubCallable callable = new StubCallable();
|
||||
Future future = mock();
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class SpringBeanAutowiringSupportTests {
|
||||
|
||||
@Test
|
||||
void testProcessInjectionBasedOnServletContext() {
|
||||
void processInjectionBasedOnServletContext() {
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
AnnotationConfigUtils.registerAnnotationConfigProcessors(wac);
|
||||
|
||||
|
||||
+2
-2
@@ -174,7 +174,7 @@ class DefaultCorsProcessorTests {
|
||||
}
|
||||
|
||||
@Test // gh-26892
|
||||
public void actualRequestTrailingSlashOriginMatch() throws Exception {
|
||||
void actualRequestTrailingSlashOriginMatch() throws Exception {
|
||||
this.request.setMethod(HttpMethod.GET.name());
|
||||
this.request.addHeader(HttpHeaders.ORIGIN, "https://domain2.com/");
|
||||
this.conf.addAllowedOrigin("https://domain2.com");
|
||||
@@ -185,7 +185,7 @@ class DefaultCorsProcessorTests {
|
||||
}
|
||||
|
||||
@Test //gh-33682
|
||||
public void actualRequestMalformedOriginRejected() throws Exception {
|
||||
void actualRequestMalformedOriginRejected() throws Exception {
|
||||
this.request.setMethod(HttpMethod.GET.name());
|
||||
this.request.addHeader(HttpHeaders.ORIGIN, "http://*@:;");
|
||||
this.conf.addAllowedOrigin("https://domain2.com");
|
||||
|
||||
@@ -67,7 +67,7 @@ class CorsUtilsTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16262
|
||||
public void isSameOriginWithXForwardedHeaders() {
|
||||
void isSameOriginWithXForwardedHeaders() {
|
||||
String server = "mydomain1.example";
|
||||
testWithXForwardedHeaders(server, -1, "https", null, -1, "https://mydomain1.example");
|
||||
testWithXForwardedHeaders(server, 123, "https", null, -1, "https://mydomain1.example");
|
||||
@@ -78,7 +78,7 @@ class CorsUtilsTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16262
|
||||
public void isSameOriginWithForwardedHeader() {
|
||||
void isSameOriginWithForwardedHeader() {
|
||||
String server = "mydomain1.example";
|
||||
testWithForwardedHeader(server, -1, "proto=https", "https://mydomain1.example");
|
||||
testWithForwardedHeader(server, 123, "proto=https", "https://mydomain1.example");
|
||||
@@ -89,7 +89,7 @@ class CorsUtilsTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16362
|
||||
public void isSameOriginWithDifferentSchemes() {
|
||||
void isSameOriginWithDifferentSchemes() {
|
||||
MockServerHttpRequest request = MockServerHttpRequest
|
||||
.get("http://mydomain1.example")
|
||||
.header(HttpHeaders.ORIGIN, "https://mydomain1.example")
|
||||
|
||||
+2
-2
@@ -178,7 +178,7 @@ class DefaultCorsProcessorTests {
|
||||
}
|
||||
|
||||
@Test // gh-26892
|
||||
public void actualRequestTrailingSlashOriginMatch() {
|
||||
void actualRequestTrailingSlashOriginMatch() {
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest
|
||||
.method(HttpMethod.GET, "http://localhost/test.html")
|
||||
.header(HttpHeaders.ORIGIN, "https://domain2.com/"));
|
||||
@@ -192,7 +192,7 @@ class DefaultCorsProcessorTests {
|
||||
}
|
||||
|
||||
@Test // gh-33682
|
||||
public void actualRequestMalformedOriginRejected() {
|
||||
void actualRequestMalformedOriginRejected() {
|
||||
ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest
|
||||
.method(HttpMethod.GET, "http://localhost/test.html")
|
||||
.header(HttpHeaders.ORIGIN, "http://*@:;"));
|
||||
|
||||
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class CompositeFilterTests {
|
||||
|
||||
@Test
|
||||
void testCompositeFilter() throws ServletException, IOException {
|
||||
void compositeFilter() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
MockFilter targetFilter = new MockFilter();
|
||||
MockFilterConfig proxyConfig = new MockFilterConfig(sc);
|
||||
|
||||
+13
-13
@@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
class DelegatingFilterProxyTests {
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxy() throws ServletException, IOException {
|
||||
void delegatingFilterProxy() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
@@ -74,7 +74,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyAndCustomContextAttribute() throws ServletException, IOException {
|
||||
void delegatingFilterProxyAndCustomContextAttribute() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
@@ -103,7 +103,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyWithFilterDelegateInstance() throws ServletException, IOException {
|
||||
void delegatingFilterProxyWithFilterDelegateInstance() throws ServletException, IOException {
|
||||
MockFilter targetFilter = new MockFilter();
|
||||
|
||||
DelegatingFilterProxy filterProxy = new DelegatingFilterProxy(targetFilter);
|
||||
@@ -121,7 +121,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyWithTargetBeanName() throws ServletException, IOException {
|
||||
void delegatingFilterProxyWithTargetBeanName() throws ServletException, IOException {
|
||||
MockServletContext sc = new MockServletContext();
|
||||
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
@@ -147,7 +147,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyWithTargetBeanNameAndNotYetRefreshedApplicationContext()
|
||||
void delegatingFilterProxyWithTargetBeanNameAndNotYetRefreshedApplicationContext()
|
||||
throws ServletException, IOException {
|
||||
|
||||
MockServletContext sc = new MockServletContext();
|
||||
@@ -175,7 +175,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyWithTargetBeanNameAndNoApplicationContext()
|
||||
void delegatingFilterProxyWithTargetBeanNameAndNoApplicationContext()
|
||||
throws ServletException {
|
||||
|
||||
MockServletContext sc = new MockServletContext();
|
||||
@@ -190,7 +190,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyWithFilterName() throws ServletException, IOException {
|
||||
void delegatingFilterProxyWithFilterName() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
@@ -217,7 +217,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyWithLazyContextStartup() throws ServletException, IOException {
|
||||
void delegatingFilterProxyWithLazyContextStartup() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
|
||||
MockFilterConfig proxyConfig = new MockFilterConfig(sc);
|
||||
@@ -245,7 +245,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyWithTargetFilterLifecycle() throws ServletException, IOException {
|
||||
void delegatingFilterProxyWithTargetFilterLifecycle() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
@@ -275,7 +275,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyWithFrameworkServletContext() throws ServletException, IOException {
|
||||
void delegatingFilterProxyWithFrameworkServletContext() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
wac.setServletContext(sc);
|
||||
@@ -302,7 +302,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyInjectedPreferred() throws ServletException, IOException {
|
||||
void delegatingFilterProxyInjectedPreferred() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
wac.setServletContext(sc);
|
||||
@@ -331,7 +331,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyNotInjectedWacServletAttrPreferred()
|
||||
void delegatingFilterProxyNotInjectedWacServletAttrPreferred()
|
||||
throws ServletException, IOException {
|
||||
|
||||
ServletContext sc = new MockServletContext();
|
||||
@@ -367,7 +367,7 @@ class DelegatingFilterProxyTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDelegatingFilterProxyNotInjectedWithRootPreferred() throws ServletException, IOException {
|
||||
void delegatingFilterProxyNotInjectedWithRootPreferred() throws ServletException, IOException {
|
||||
ServletContext sc = new MockServletContext();
|
||||
StaticWebApplicationContext wac = new StaticWebApplicationContext();
|
||||
wac.setServletContext(sc);
|
||||
|
||||
@@ -207,7 +207,7 @@ class FormContentFilterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-15835
|
||||
public void hiddenHttpMethodFilterFollowedByHttpPutFormContentFilter() throws Exception {
|
||||
void hiddenHttpMethodFilterFollowedByHttpPutFormContentFilter() throws Exception {
|
||||
this.request.addParameter("_method", "PUT");
|
||||
this.request.addParameter("hiddenField", "testHidden");
|
||||
this.filter.doFilter(this.request, this.response, this.filterChain);
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ class OncePerRequestFilterTests {
|
||||
}
|
||||
|
||||
@Test // gh-23196
|
||||
public void filterNestedErrorDispatch() throws ServletException, IOException {
|
||||
void filterNestedErrorDispatch() throws ServletException, IOException {
|
||||
|
||||
// Opt in for ERROR dispatch
|
||||
this.filter.setShouldNotFilterErrorDispatch(false);
|
||||
|
||||
+2
-2
@@ -172,7 +172,7 @@ class ShallowEtagHeaderFilterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-12960
|
||||
public void filterWriterWithDisabledCaching() throws Exception {
|
||||
void filterWriterWithDisabledCaching() throws Exception {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hotels");
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
response.setContentType(TEXT_PLAIN_VALUE);
|
||||
@@ -257,7 +257,7 @@ class ShallowEtagHeaderFilterTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13717
|
||||
public void filterFlushResponse() throws Exception {
|
||||
void filterFlushResponse() throws Exception {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest("GET", "/hotels");
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
|
||||
+1
-1
@@ -202,7 +202,7 @@ class ControllerAdviceBeanTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public void findAnnotatedBeansSortsBeans() {
|
||||
void findAnnotatedBeansSortsBeans() {
|
||||
Class[] expectedTypes = {
|
||||
// Since ControllerAdviceBean currently treats PriorityOrdered the same as Ordered,
|
||||
// OrderedControllerAdvice is sorted before PriorityOrderedControllerAdvice.
|
||||
|
||||
+2
-2
@@ -247,7 +247,7 @@ class ModelAttributeMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // SPR-9378
|
||||
public void resolveArgumentOrdering() throws Exception {
|
||||
void resolveArgumentOrdering() throws Exception {
|
||||
String name = "testBean";
|
||||
Object testBean = new TestBean(name);
|
||||
this.container.addAttribute(name, testBean);
|
||||
@@ -282,7 +282,7 @@ class ModelAttributeMethodProcessorTests {
|
||||
}
|
||||
|
||||
@Test // gh-25182
|
||||
public void resolveConstructorListArgumentFromCommaSeparatedRequestParameter() throws Exception {
|
||||
void resolveConstructorListArgumentFromCommaSeparatedRequestParameter() throws Exception {
|
||||
MockHttpServletRequest mockRequest = new MockHttpServletRequest();
|
||||
mockRequest.addParameter("listOfStrings", "1,2");
|
||||
ServletWebRequest requestWithParam = new ServletWebRequest(mockRequest);
|
||||
|
||||
+1
-1
@@ -312,7 +312,7 @@ class RequestHeaderMethodArgumentResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uuidPlaceholderConversionWithEmptyValue() {
|
||||
void uuidPlaceholderConversionWithEmptyValue() {
|
||||
try {
|
||||
String expected = "name";
|
||||
servletRequest.addHeader(expected, "");
|
||||
|
||||
+4
-4
@@ -108,7 +108,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void resolveMapOfMultipartFile() throws Exception {
|
||||
void resolveMapOfMultipartFile() throws Exception {
|
||||
MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest();
|
||||
MultipartFile expected1 = new MockMultipartFile("mfile", "Hello World".getBytes());
|
||||
MultipartFile expected2 = new MockMultipartFile("other", "Hello World 3".getBytes());
|
||||
@@ -129,7 +129,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void resolveMultiValueMapOfMultipartFile() throws Exception {
|
||||
void resolveMultiValueMapOfMultipartFile() throws Exception {
|
||||
MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest();
|
||||
MultipartFile expected1 = new MockMultipartFile("mfilelist", "Hello World 1".getBytes());
|
||||
MultipartFile expected2 = new MockMultipartFile("mfilelist", "Hello World 2".getBytes());
|
||||
@@ -152,7 +152,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void resolveMapOfPart() throws Exception {
|
||||
void resolveMapOfPart() throws Exception {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setContentType("multipart/form-data");
|
||||
Part expected1 = new MockPart("mfile", "Hello World".getBytes());
|
||||
@@ -174,7 +174,7 @@ class RequestParamMapMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void resolveMultiValueMapOfPart() throws Exception {
|
||||
void resolveMultiValueMapOfPart() throws Exception {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setContentType("multipart/form-data");
|
||||
Part expected1 = new MockPart("mfilelist", "Hello World 1".getBytes());
|
||||
|
||||
+12
-12
@@ -371,7 +371,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
}
|
||||
|
||||
@Test // SPR-9079
|
||||
public void isMultipartRequestHttpPut() throws Exception {
|
||||
void isMultipartRequestHttpPut() throws Exception {
|
||||
MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest();
|
||||
MultipartFile expected = new MockMultipartFile("multipartFileList", "Hello World".getBytes());
|
||||
request.addFile(expected);
|
||||
@@ -431,7 +431,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
}
|
||||
|
||||
@Test // SPR-10578
|
||||
public void missingRequestParamEmptyValueConvertedToNull() throws Exception {
|
||||
void missingRequestParamEmptyValueConvertedToNull() throws Exception {
|
||||
WebDataBinder binder = new WebRequestDataBinder(null);
|
||||
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
|
||||
|
||||
@@ -445,7 +445,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
}
|
||||
|
||||
@Test // gh-31336
|
||||
public void missingRequestParamAfterConversionWithDefaultValue() throws Exception {
|
||||
void missingRequestParamAfterConversionWithDefaultValue() throws Exception {
|
||||
WebDataBinder binder = new WebRequestDataBinder(null);
|
||||
|
||||
WebDataBinderFactory binderFactory = mock();
|
||||
@@ -472,7 +472,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
}
|
||||
|
||||
@Test // gh-29550
|
||||
public void missingRequestParamEmptyValueNotRequiredWithDefaultValue() throws Exception {
|
||||
void missingRequestParamEmptyValueNotRequiredWithDefaultValue() throws Exception {
|
||||
WebDataBinder binder = new WebRequestDataBinder(null);
|
||||
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
|
||||
|
||||
@@ -494,14 +494,14 @@ class RequestParamMethodArgumentResolverTests {
|
||||
}
|
||||
|
||||
@Test // SPR-8561
|
||||
public void resolveSimpleTypeParamToNull() throws Exception {
|
||||
void resolveSimpleTypeParamToNull() throws Exception {
|
||||
MethodParameter param = this.testMethod.annotNotPresent(RequestParam.class).arg(String.class);
|
||||
Object result = resolver.resolveArgument(param, null, webRequest, null);
|
||||
assertThat(result).isNull();
|
||||
}
|
||||
|
||||
@Test // SPR-10180
|
||||
public void resolveEmptyValueToDefault() throws Exception {
|
||||
void resolveEmptyValueToDefault() throws Exception {
|
||||
request.addParameter("name", "");
|
||||
MethodParameter param = this.testMethod.annot(requestParam().notRequired("bar")).arg(String.class);
|
||||
Object result = resolver.resolveArgument(param, null, webRequest, null);
|
||||
@@ -526,7 +526,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void resolveOptionalParamValue() throws Exception {
|
||||
void resolveOptionalParamValue() throws Exception {
|
||||
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
||||
initializer.setConversionService(new DefaultConversionService());
|
||||
WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer);
|
||||
@@ -543,7 +543,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void missingOptionalParamValue() throws Exception {
|
||||
void missingOptionalParamValue() throws Exception {
|
||||
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
||||
initializer.setConversionService(new DefaultConversionService());
|
||||
WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer);
|
||||
@@ -559,7 +559,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void resolveOptionalParamArray() throws Exception {
|
||||
void resolveOptionalParamArray() throws Exception {
|
||||
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
||||
initializer.setConversionService(new DefaultConversionService());
|
||||
WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer);
|
||||
@@ -576,7 +576,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void missingOptionalParamArray() throws Exception {
|
||||
void missingOptionalParamArray() throws Exception {
|
||||
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
||||
initializer.setConversionService(new DefaultConversionService());
|
||||
WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer);
|
||||
@@ -592,7 +592,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void resolveOptionalParamList() throws Exception {
|
||||
void resolveOptionalParamList() throws Exception {
|
||||
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
||||
initializer.setConversionService(new DefaultConversionService());
|
||||
WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer);
|
||||
@@ -609,7 +609,7 @@ class RequestParamMethodArgumentResolverTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void missingOptionalParamList() throws Exception {
|
||||
void missingOptionalParamList() throws Exception {
|
||||
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
||||
initializer.setConversionService(new DefaultConversionService());
|
||||
WebDataBinderFactory binderFactory = new DefaultDataBinderFactory(initializer);
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ class InvocableHandlerMethodTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13917
|
||||
public void invocationErrorMessage() {
|
||||
void invocationErrorMessage() {
|
||||
this.composite.addResolver(new StubArgumentResolver(double.class));
|
||||
assertThatIllegalStateException()
|
||||
.isThrownBy(() -> getInvocable(double.class).invokeForRequest(this.request, null))
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ class ModelAndViewContainerTests {
|
||||
}
|
||||
|
||||
@Test // SPR-14045
|
||||
public void ignoreDefaultModelAndWithoutRedirectModel() {
|
||||
void ignoreDefaultModelAndWithoutRedirectModel() {
|
||||
this.mavContainer.setRedirectModelScenario(true);
|
||||
this.mavContainer.addAttribute("name", "value");
|
||||
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ class DefaultMultipartHttpServletRequestTests {
|
||||
|
||||
|
||||
@Test // SPR-16590
|
||||
public void parameterValues() {
|
||||
void parameterValues() {
|
||||
|
||||
this.multipartParams.put("key", new String[] {"p"});
|
||||
this.queryParams.add("key", "q");
|
||||
@@ -54,7 +54,7 @@ class DefaultMultipartHttpServletRequestTests {
|
||||
}
|
||||
|
||||
@Test // SPR-16590
|
||||
public void parameterMap() {
|
||||
void parameterMap() {
|
||||
|
||||
this.multipartParams.put("key1", new String[] {"p1"});
|
||||
this.multipartParams.put("key2", new String[] {"p2"});
|
||||
|
||||
+3
-3
@@ -90,7 +90,7 @@ class RequestPartServletServerHttpRequestTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13317
|
||||
public void getBodyWithWrappedRequest() throws Exception {
|
||||
void getBodyWithWrappedRequest() throws Exception {
|
||||
byte[] bytes = "content".getBytes(StandardCharsets.UTF_8);
|
||||
MultipartFile part = new MockMultipartFile("part", "", "application/json", bytes);
|
||||
this.mockRequest.addFile(part);
|
||||
@@ -102,7 +102,7 @@ class RequestPartServletServerHttpRequestTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13096
|
||||
public void getBodyViaRequestParameter() throws Exception {
|
||||
void getBodyViaRequestParameter() throws Exception {
|
||||
MockMultipartHttpServletRequest mockRequest = new MockMultipartHttpServletRequest() {
|
||||
@Override
|
||||
public HttpHeaders getMultipartHeaders(String paramOrFileName) {
|
||||
@@ -139,7 +139,7 @@ class RequestPartServletServerHttpRequestTests {
|
||||
}
|
||||
|
||||
@Test // gh-25829
|
||||
public void getBodyViaRequestPart() throws Exception {
|
||||
void getBodyViaRequestPart() throws Exception {
|
||||
byte[] bytes = "content".getBytes(StandardCharsets.UTF_8);
|
||||
MockPart mockPart = new MockPart("part", bytes);
|
||||
mockPart.getHeaders().setContentType(MediaType.APPLICATION_JSON);
|
||||
|
||||
+1
-1
@@ -339,7 +339,7 @@ class WebHttpHandlerBuilderTests {
|
||||
static class ObservationConfig {
|
||||
|
||||
@Bean
|
||||
public TestObservationRegistry testObservationRegistry() {
|
||||
public TestObservationRegistry observationRegistry() {
|
||||
return TestObservationRegistry.create();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ class HttpServiceMethodTests {
|
||||
);
|
||||
}
|
||||
|
||||
protected void verifyReactorClientInvocation(String methodName, @Nullable ParameterizedTypeReference<?> expectedBodyType) {
|
||||
void verifyReactorClientInvocation(String methodName, @Nullable ParameterizedTypeReference<?> expectedBodyType) {
|
||||
assertThat(this.reactorClient.getInvokedMethodName()).isEqualTo(methodName);
|
||||
assertThat(this.reactorClient.getBodyType()).isEqualTo(expectedBodyType);
|
||||
}
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ class DefaultUriBuilderFactoryTests {
|
||||
}
|
||||
|
||||
@Test // SPR-17465
|
||||
public void defaultSettingsWithBuilder() {
|
||||
void defaultSettingsWithBuilder() {
|
||||
DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory();
|
||||
URI uri = factory.builder().path("/foo/{id}").build("a/b");
|
||||
assertThat(uri.toString()).isEqualTo("/foo/a%2Fb");
|
||||
@@ -174,7 +174,7 @@ class DefaultUriBuilderFactoryTests {
|
||||
}
|
||||
|
||||
@Test // SPR-15201
|
||||
public void pathWithTrailingSlash() {
|
||||
void pathWithTrailingSlash() {
|
||||
DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory();
|
||||
URI uri = factory.expand("https://localhost:8080/spring/");
|
||||
assertThat(uri.toString()).isEqualTo("https://localhost:8080/spring/");
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ class HtmlCharacterEntityReferencesTests {
|
||||
private static final String DTD_FILE = "HtmlCharacterEntityReferences.dtd";
|
||||
|
||||
@Test
|
||||
void testSupportsAllCharacterEntityReferencesDefinedByHtml() {
|
||||
void supportsAllCharacterEntityReferencesDefinedByHtml() {
|
||||
HtmlCharacterEntityReferences references = new HtmlCharacterEntityReferences();
|
||||
Map<Integer, String> charactersMap = getReferenceCharacterMap();
|
||||
for (int character = 0; character < 10000; character++) {
|
||||
@@ -81,7 +81,7 @@ class HtmlCharacterEntityReferencesTests {
|
||||
|
||||
// SPR-9293
|
||||
@Test
|
||||
void testConvertToReferenceUTF8() {
|
||||
void convertToReferenceUTF8() {
|
||||
HtmlCharacterEntityReferences entityReferences = new HtmlCharacterEntityReferences();
|
||||
String utf8 = "UTF-8";
|
||||
assertThat(entityReferences.convertToReference('<', utf8)).isEqualTo("<");
|
||||
|
||||
@@ -129,7 +129,7 @@ class TagUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAssertHasAncestorOfTypeDoesNotThrowExceptionOnPass() {
|
||||
void assertHasAncestorOfTypeDoesNotThrowExceptionOnPass() {
|
||||
Tag a = new TagA();
|
||||
Tag b = new TagB();
|
||||
Tag c = new TagC();
|
||||
|
||||
+2
-2
@@ -775,7 +775,7 @@ class UriComponentsBuilderTests {
|
||||
}
|
||||
|
||||
@Test // gh-25243
|
||||
void testCloneAndMerge() {
|
||||
void cloneAndMerge() {
|
||||
UriComponentsBuilder builder1 = UriComponentsBuilder.newInstance();
|
||||
builder1.scheme("http").host("e1.com").path("/p1").pathSegment("ps1").queryParam("q1", "x").fragment("f1").encode();
|
||||
|
||||
@@ -800,7 +800,7 @@ class UriComponentsBuilderTests {
|
||||
}
|
||||
|
||||
@Test // gh-24772
|
||||
void testDeepClone() {
|
||||
void deepClone() {
|
||||
HashMap<String, Object> vars = new HashMap<>();
|
||||
vars.put("ps1", "foo");
|
||||
vars.put("ps2", "bar");
|
||||
|
||||
+2
-2
@@ -50,14 +50,14 @@ class PathPatternRouteMatcherTests {
|
||||
}
|
||||
|
||||
@Test // gh-23310
|
||||
public void noDecodingAndNoParamParsing() {
|
||||
void noDecodingAndNoParamParsing() {
|
||||
PathPatternRouteMatcher routeMatcher = new PathPatternRouteMatcher();
|
||||
RouteMatcher.Route route = routeMatcher.parseRoute("projects.spring%20framework;p=1");
|
||||
assertThat(routeMatcher.match("projects.spring%20framework;p=1", route)).isTrue();
|
||||
}
|
||||
|
||||
@Test // gh-23310
|
||||
public void separatorOnlyDecoded() {
|
||||
void separatorOnlyDecoded() {
|
||||
PathPatternRouteMatcher routeMatcher = new PathPatternRouteMatcher();
|
||||
RouteMatcher.Route route = routeMatcher.parseRoute("projects.spring%2Eframework");
|
||||
Map<String, String> vars = routeMatcher.matchAndExtract("projects.{project}", route);
|
||||
|
||||
@@ -609,7 +609,7 @@ class PathPatternTests {
|
||||
}
|
||||
|
||||
@Test // SPR-15264
|
||||
public void extractUriTemplateVariables() {
|
||||
void extractUriTemplateVariables() {
|
||||
PathPattern pp;
|
||||
pp = new PathPatternParser().parse("/{foo}");
|
||||
assertMatches(pp,"/abc");
|
||||
@@ -1008,7 +1008,7 @@ class PathPatternTests {
|
||||
}
|
||||
|
||||
@Test // SPR-13286
|
||||
public void caseInsensitive() {
|
||||
void caseInsensitive() {
|
||||
PathPatternParser pp = new PathPatternParser();
|
||||
pp.setCaseSensitive(false);
|
||||
PathPattern p = pp.parse("/group/{groupName}/members");
|
||||
|
||||
+6
-6
@@ -61,21 +61,21 @@ public abstract class AbstractResponseStatusExceptionHandlerTests {
|
||||
|
||||
|
||||
@Test
|
||||
protected void handleResponseStatusException() {
|
||||
void handleResponseStatusException() {
|
||||
Throwable ex = new ResponseStatusException(HttpStatus.BAD_REQUEST, "");
|
||||
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
|
||||
assertThat(this.exchange.getResponse().getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test
|
||||
protected void handleNestedResponseStatusException() {
|
||||
void handleNestedResponseStatusException() {
|
||||
Throwable ex = new Exception(new ResponseStatusException(HttpStatus.BAD_REQUEST, ""));
|
||||
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
|
||||
assertThat(this.exchange.getResponse().getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test // gh-23741
|
||||
protected void handleMethodNotAllowed() {
|
||||
void handleMethodNotAllowed() {
|
||||
Throwable ex = new MethodNotAllowedException(HttpMethod.PATCH, Arrays.asList(HttpMethod.POST, HttpMethod.PUT));
|
||||
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
|
||||
|
||||
@@ -85,7 +85,7 @@ public abstract class AbstractResponseStatusExceptionHandlerTests {
|
||||
}
|
||||
|
||||
@Test // gh-23741
|
||||
protected void handleResponseStatusExceptionWithHeaders() {
|
||||
void handleResponseStatusExceptionWithHeaders() {
|
||||
Throwable ex = new NotAcceptableStatusException(Arrays.asList(MediaType.TEXT_PLAIN, MediaType.TEXT_HTML));
|
||||
this.handler.handle(this.exchange, ex).block(Duration.ofSeconds(5));
|
||||
|
||||
@@ -95,14 +95,14 @@ public abstract class AbstractResponseStatusExceptionHandlerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
protected void unresolvedException() {
|
||||
void unresolvedException() {
|
||||
Throwable expected = new IllegalStateException();
|
||||
Mono<Void> mono = this.handler.handle(this.exchange, expected);
|
||||
StepVerifier.create(mono).consumeErrorWith(actual -> assertThat(actual).isSameAs(expected)).verify();
|
||||
}
|
||||
|
||||
@Test // SPR-16231
|
||||
protected void responseCommitted() {
|
||||
void responseCommitted() {
|
||||
Throwable ex = new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Oops");
|
||||
this.exchange.getResponse().setStatusCode(HttpStatus.CREATED);
|
||||
Mono<Void> mono = this.exchange.getResponse().setComplete()
|
||||
|
||||
Reference in New Issue
Block a user