Skip to content

Commit 6dc5bf7

Browse files
committed
Clean up warnings related to deprecated HttpStatus values, etc.
1 parent 521764e commit 6dc5bf7

File tree

20 files changed

+37
-35
lines changed

20 files changed

+37
-35
lines changed

spring-context/src/test/java/org/springframework/context/annotation/ResourceElementResolverMethodTests.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,16 @@ static class TestBean {
134134

135135
private String one;
136136

137-
private String test;
138-
139-
private Integer count;
140-
141137
public void setOne(String one) {
142138
this.one = one;
143139
}
144140

145141
public void setTest(String test) {
146-
this.test = test;
142+
// no-op
147143
}
148144

149145
public void setCount(Integer count) {
150-
this.count = count;
146+
// no-op
151147
}
152148
}
153149

spring-context/src/testFixtures/java/org/springframework/context/testfixture/context/annotation/PackagePrivateMethodResourceSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
public class PackagePrivateMethodResourceSample {
2222

23-
private String one;
23+
String one;
2424

2525
@Resource
2626
void setOne(String one) {

spring-context/src/testFixtures/java/org/springframework/context/testfixture/context/annotation/PrivateMethodResourceSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
public class PrivateMethodResourceSample {
2222

23-
private String one;
23+
String one;
2424

2525
@Resource
2626
private void setOne(String one) {

spring-context/src/testFixtures/java/org/springframework/context/testfixture/context/annotation/PrivateMethodResourceWithCustomNameSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
public class PrivateMethodResourceWithCustomNameSample {
2222

23-
private String text;
23+
String text;
2424

2525
@Resource(name = "one")
2626
private void setText(String text) {

spring-context/src/testFixtures/java/org/springframework/context/testfixture/context/annotation/PublicMethodResourceSample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
public class PublicMethodResourceSample {
2222

23-
private String one;
23+
String one;
2424

2525
@Resource
2626
public void setOne(String one) {

spring-test/src/test/java/org/springframework/test/web/servlet/client/samples/JsonContentTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ ResponseEntity<String> savePerson(@RequestBody Person person) {
149149
}
150150

151151

152-
private static class Person {
152+
static class Person {
153153
private String firstName;
154154
private String lastName;
155155

spring-test/src/test/java/org/springframework/test/web/servlet/client/samples/bind/FilterTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
import org.springframework.test.web.servlet.client.RestTestClient;
3030
import org.springframework.web.servlet.function.ServerResponse;
3131

32-
import static org.springframework.http.HttpStatus.I_AM_A_TEAPOT;
33-
32+
import static org.springframework.http.HttpStatus.EXPECTATION_FAILED;
3433

3534
/**
3635
* Tests for a {@link Filter}.
36+
*
3737
* @author Rob Worsnop
3838
*/
3939
class FilterTests {
@@ -49,7 +49,7 @@ protected void doFilter(HttpServletRequest req, HttpServletResponse res, FilterC
4949
};
5050

5151
RestTestClient client = RestTestClient.bindToRouterFunction(
52-
request -> Optional.of(req -> ServerResponse.status(I_AM_A_TEAPOT).build()))
52+
request -> Optional.of(req -> ServerResponse.status(EXPECTATION_FAILED).build()))
5353
.configureServer(builder -> builder.addFilters(filter))
5454
.build();
5555

spring-test/src/test/java/org/springframework/test/web/servlet/samples/client/standalone/resultmatches/StatusAssertionTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
3636
import static org.springframework.http.HttpStatus.BAD_REQUEST;
3737
import static org.springframework.http.HttpStatus.CREATED;
38+
import static org.springframework.http.HttpStatus.EXPECTATION_FAILED;
3839
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
39-
import static org.springframework.http.HttpStatus.I_AM_A_TEAPOT;
4040
import static org.springframework.http.HttpStatus.NOT_IMPLEMENTED;
4141

4242
/**
@@ -55,11 +55,11 @@ class StatusAssertionTests {
5555

5656
@Test
5757
void statusInt() {
58-
testClient.get().uri("/teaPot").exchange().expectStatus().isEqualTo(I_AM_A_TEAPOT.value());
58+
testClient.get().uri("/teaPot").exchange().expectStatus().isEqualTo(EXPECTATION_FAILED.value());
5959
testClient.get().uri("/created").exchange().expectStatus().isEqualTo(CREATED.value());
6060
testClient.get().uri("/createdWithComposedAnnotation").exchange().expectStatus().isEqualTo(CREATED.value());
6161
testClient.get().uri("/badRequest").exchange().expectStatus().isEqualTo(BAD_REQUEST.value());
62-
testClient.get().uri("/throwsException").exchange().expectStatus().isEqualTo(I_AM_A_TEAPOT.value());
62+
testClient.get().uri("/throwsException").exchange().expectStatus().isEqualTo(EXPECTATION_FAILED.value());
6363
}
6464

6565
@Test
@@ -88,7 +88,7 @@ void matcher() {
8888
}
8989

9090
@RestController
91-
@ResponseStatus(I_AM_A_TEAPOT)
91+
@ResponseStatus(EXPECTATION_FAILED)
9292
private static class StatusController {
9393

9494
@RequestMapping("/teaPot")

spring-test/src/test/java/org/springframework/test/web/servlet/samples/standalone/resultmatchers/StatusAssertionTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
3636
import static org.springframework.http.HttpStatus.BAD_REQUEST;
3737
import static org.springframework.http.HttpStatus.CREATED;
38+
import static org.springframework.http.HttpStatus.EXPECTATION_FAILED;
3839
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
39-
import static org.springframework.http.HttpStatus.I_AM_A_TEAPOT;
4040
import static org.springframework.http.HttpStatus.NOT_IMPLEMENTED;
4141
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
4242
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -62,11 +62,11 @@ void httpStatus() throws Exception {
6262

6363
@Test
6464
void statusCode() throws Exception {
65-
this.mockMvc.perform(get("/teaPot")).andExpect(status().is(I_AM_A_TEAPOT.value()));
65+
this.mockMvc.perform(get("/expectationFailed")).andExpect(status().is(EXPECTATION_FAILED.value()));
6666
this.mockMvc.perform(get("/created")).andExpect(status().is(CREATED.value()));
6767
this.mockMvc.perform(get("/createdWithComposedAnnotation")).andExpect(status().is(CREATED.value()));
6868
this.mockMvc.perform(get("/badRequest")).andExpect(status().is(BAD_REQUEST.value()));
69-
this.mockMvc.perform(get("/throwsException")).andExpect(status().is(I_AM_A_TEAPOT.value()));
69+
this.mockMvc.perform(get("/throwsException")).andExpect(status().is(EXPECTATION_FAILED.value()));
7070
}
7171

7272
@Test
@@ -99,11 +99,11 @@ void reasonWithMatcher() throws Exception {
9999
}
100100

101101
@RestController
102-
@ResponseStatus(I_AM_A_TEAPOT)
102+
@ResponseStatus(EXPECTATION_FAILED)
103103
private static class StatusController {
104104

105-
@RequestMapping("/teaPot")
106-
void teaPot() {
105+
@RequestMapping("/expectationFailed")
106+
void expectationFailed() {
107107
}
108108

109109
@RequestMapping("/created")

spring-web/src/main/java/org/springframework/web/client/HttpClientErrorException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public static HttpClientErrorException create(
9595
* with an optional prepared message.
9696
* @since 5.2.2
9797
*/
98+
@SuppressWarnings("deprecation")
9899
public static HttpClientErrorException create(@Nullable String message, HttpStatusCode statusCode,
99100
String statusText, HttpHeaders headers, byte[] body, @Nullable Charset charset) {
100101

0 commit comments

Comments
 (0)