Remove deprecated APIs in spring-web
See gh-33809
This commit is contained in:
@@ -190,7 +190,6 @@ class DefaultClientResponseTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void toEntity() {
|
||||
byte[] bytes = "foo".getBytes(StandardCharsets.UTF_8);
|
||||
DataBuffer dataBuffer = DefaultDataBufferFactory.sharedInstance.wrap(bytes);
|
||||
@@ -202,12 +201,10 @@ class DefaultClientResponseTests {
|
||||
ResponseEntity<String> result = defaultClientResponse.toEntity(String.class).block();
|
||||
assertThat(result.getBody()).isEqualTo("foo");
|
||||
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(result.getStatusCodeValue()).isEqualTo(HttpStatus.OK.value());
|
||||
assertThat(result.getHeaders().getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void toEntityWithUnknownStatusCode() {
|
||||
byte[] bytes = "foo".getBytes(StandardCharsets.UTF_8);
|
||||
DataBuffer dataBuffer = DefaultDataBufferFactory.sharedInstance.wrap(bytes);
|
||||
@@ -222,13 +219,11 @@ class DefaultClientResponseTests {
|
||||
|
||||
ResponseEntity<String> result = defaultClientResponse.toEntity(String.class).block();
|
||||
assertThat(result.getBody()).isEqualTo("foo");
|
||||
assertThat(result.getStatusCode()).isEqualTo(HttpStatusCode.valueOf(999));
|
||||
assertThat(result.getStatusCodeValue()).isEqualTo(999);
|
||||
assertThat(result.getStatusCode().value()).isEqualTo(999);
|
||||
assertThat(result.getHeaders().getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void toEntityTypeReference() {
|
||||
byte[] bytes = "foo".getBytes(StandardCharsets.UTF_8);
|
||||
DataBuffer dataBuffer = DefaultDataBufferFactory.sharedInstance.wrap(bytes);
|
||||
@@ -240,12 +235,10 @@ class DefaultClientResponseTests {
|
||||
ResponseEntity<String> result = defaultClientResponse.toEntity(STRING_TYPE).block();
|
||||
assertThat(result.getBody()).isEqualTo("foo");
|
||||
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(result.getStatusCodeValue()).isEqualTo(HttpStatus.OK.value());
|
||||
assertThat(result.getHeaders().getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void toEntityList() {
|
||||
byte[] bytes = "foo".getBytes(StandardCharsets.UTF_8);
|
||||
DataBuffer dataBuffer = DefaultDataBufferFactory.sharedInstance.wrap(bytes);
|
||||
@@ -257,12 +250,10 @@ class DefaultClientResponseTests {
|
||||
ResponseEntity<List<String>> result = defaultClientResponse.toEntityList(String.class).block();
|
||||
assertThat(result.getBody()).containsExactly("foo");
|
||||
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(result.getStatusCodeValue()).isEqualTo(HttpStatus.OK.value());
|
||||
assertThat(result.getHeaders().getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void toEntityListWithUnknownStatusCode() {
|
||||
byte[] bytes = "foo".getBytes(StandardCharsets.UTF_8);
|
||||
DataBuffer dataBuffer = DefaultDataBufferFactory.sharedInstance.wrap(bytes);
|
||||
@@ -278,12 +269,10 @@ class DefaultClientResponseTests {
|
||||
ResponseEntity<List<String>> result = defaultClientResponse.toEntityList(String.class).block();
|
||||
assertThat(result.getBody()).containsExactly("foo");
|
||||
assertThat(result.getStatusCode()).isEqualTo(HttpStatusCode.valueOf(999));
|
||||
assertThat(result.getStatusCodeValue()).isEqualTo(999);
|
||||
assertThat(result.getHeaders().getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void toEntityListTypeReference() {
|
||||
byte[] bytes = "foo".getBytes(StandardCharsets.UTF_8);
|
||||
DataBuffer dataBuffer = DefaultDataBufferFactory.sharedInstance.wrap(bytes);
|
||||
@@ -296,7 +285,6 @@ class DefaultClientResponseTests {
|
||||
ResponseEntity<List<String>> result = defaultClientResponse.toEntityList(STRING_TYPE).block();
|
||||
assertThat(result.getBody()).containsExactly("foo");
|
||||
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(result.getStatusCodeValue()).isEqualTo(HttpStatus.OK.value());
|
||||
assertThat(result.getHeaders().getContentType()).isEqualTo(MediaType.TEXT_PLAIN);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1150,7 +1150,6 @@ class WebClientIntegrationTests {
|
||||
}
|
||||
|
||||
@ParameterizedWebClientTest
|
||||
@SuppressWarnings("deprecation")
|
||||
void exchangeForUnknownStatusCode(ClientHttpConnector connector) {
|
||||
startServer(connector);
|
||||
|
||||
@@ -1165,7 +1164,7 @@ class WebClientIntegrationTests {
|
||||
.exchangeToMono(ClientResponse::toBodilessEntity);
|
||||
|
||||
StepVerifier.create(result)
|
||||
.consumeNextWith(entity -> assertThat(entity.getStatusCodeValue()).isEqualTo(555))
|
||||
.consumeNextWith(entity -> assertThat(entity.getStatusCode().value()).isEqualTo(555))
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(3));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user