mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-22 05:49:04 +00:00
Clean up warnings related to deprecated HttpStatus values, etc.
This commit is contained in:
+1
-1
@@ -149,7 +149,7 @@ class JsonContentTests {
|
||||
}
|
||||
|
||||
|
||||
private static class Person {
|
||||
static class Person {
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
|
||||
|
||||
+3
-3
@@ -29,11 +29,11 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.test.web.servlet.client.RestTestClient;
|
||||
import org.springframework.web.servlet.function.ServerResponse;
|
||||
|
||||
import static org.springframework.http.HttpStatus.I_AM_A_TEAPOT;
|
||||
|
||||
import static org.springframework.http.HttpStatus.EXPECTATION_FAILED;
|
||||
|
||||
/**
|
||||
* Tests for a {@link Filter}.
|
||||
*
|
||||
* @author Rob Worsnop
|
||||
*/
|
||||
class FilterTests {
|
||||
@@ -49,7 +49,7 @@ class FilterTests {
|
||||
};
|
||||
|
||||
RestTestClient client = RestTestClient.bindToRouterFunction(
|
||||
request -> Optional.of(req -> ServerResponse.status(I_AM_A_TEAPOT).build()))
|
||||
request -> Optional.of(req -> ServerResponse.status(EXPECTATION_FAILED).build()))
|
||||
.configureServer(builder -> builder.addFilters(filter))
|
||||
.build();
|
||||
|
||||
|
||||
+4
-4
@@ -35,8 +35,8 @@ import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.EXPECTATION_FAILED;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.I_AM_A_TEAPOT;
|
||||
import static org.springframework.http.HttpStatus.NOT_IMPLEMENTED;
|
||||
|
||||
/**
|
||||
@@ -55,11 +55,11 @@ class StatusAssertionTests {
|
||||
|
||||
@Test
|
||||
void statusInt() {
|
||||
testClient.get().uri("/teaPot").exchange().expectStatus().isEqualTo(I_AM_A_TEAPOT.value());
|
||||
testClient.get().uri("/teaPot").exchange().expectStatus().isEqualTo(EXPECTATION_FAILED.value());
|
||||
testClient.get().uri("/created").exchange().expectStatus().isEqualTo(CREATED.value());
|
||||
testClient.get().uri("/createdWithComposedAnnotation").exchange().expectStatus().isEqualTo(CREATED.value());
|
||||
testClient.get().uri("/badRequest").exchange().expectStatus().isEqualTo(BAD_REQUEST.value());
|
||||
testClient.get().uri("/throwsException").exchange().expectStatus().isEqualTo(I_AM_A_TEAPOT.value());
|
||||
testClient.get().uri("/throwsException").exchange().expectStatus().isEqualTo(EXPECTATION_FAILED.value());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -88,7 +88,7 @@ class StatusAssertionTests {
|
||||
}
|
||||
|
||||
@RestController
|
||||
@ResponseStatus(I_AM_A_TEAPOT)
|
||||
@ResponseStatus(EXPECTATION_FAILED)
|
||||
private static class StatusController {
|
||||
|
||||
@RequestMapping("/teaPot")
|
||||
|
||||
+6
-6
@@ -35,8 +35,8 @@ import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.CREATED;
|
||||
import static org.springframework.http.HttpStatus.EXPECTATION_FAILED;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
import static org.springframework.http.HttpStatus.I_AM_A_TEAPOT;
|
||||
import static org.springframework.http.HttpStatus.NOT_IMPLEMENTED;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
@@ -62,11 +62,11 @@ class StatusAssertionTests {
|
||||
|
||||
@Test
|
||||
void statusCode() throws Exception {
|
||||
this.mockMvc.perform(get("/teaPot")).andExpect(status().is(I_AM_A_TEAPOT.value()));
|
||||
this.mockMvc.perform(get("/expectationFailed")).andExpect(status().is(EXPECTATION_FAILED.value()));
|
||||
this.mockMvc.perform(get("/created")).andExpect(status().is(CREATED.value()));
|
||||
this.mockMvc.perform(get("/createdWithComposedAnnotation")).andExpect(status().is(CREATED.value()));
|
||||
this.mockMvc.perform(get("/badRequest")).andExpect(status().is(BAD_REQUEST.value()));
|
||||
this.mockMvc.perform(get("/throwsException")).andExpect(status().is(I_AM_A_TEAPOT.value()));
|
||||
this.mockMvc.perform(get("/throwsException")).andExpect(status().is(EXPECTATION_FAILED.value()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -99,11 +99,11 @@ class StatusAssertionTests {
|
||||
}
|
||||
|
||||
@RestController
|
||||
@ResponseStatus(I_AM_A_TEAPOT)
|
||||
@ResponseStatus(EXPECTATION_FAILED)
|
||||
private static class StatusController {
|
||||
|
||||
@RequestMapping("/teaPot")
|
||||
void teaPot() {
|
||||
@RequestMapping("/expectationFailed")
|
||||
void expectationFailed() {
|
||||
}
|
||||
|
||||
@RequestMapping("/created")
|
||||
|
||||
Reference in New Issue
Block a user