mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-25 16:29:28 +00:00
Update RestTestClient builder hierarchy
Add concrete classes with specified generics for each MockMvc setup Ensure Builder methods return the concrete class See gh-34428
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
class JsonPathAssertionTests {
|
||||
|
||||
private final RestTestClient client =
|
||||
RestTestClient.standaloneSetup(new MusicController())
|
||||
RestTestClient.bindToController(new MusicController())
|
||||
.configureServer(builder ->
|
||||
builder.alwaysExpect(status().isOk())
|
||||
.alwaysExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
class ErrorTests {
|
||||
|
||||
private final RestTestClient client = RestTestClient.standaloneSetup(new TestController()).build();
|
||||
private final RestTestClient client = RestTestClient.bindToController(new TestController()).build();
|
||||
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
*/
|
||||
class HeaderAndCookieTests {
|
||||
|
||||
private final RestTestClient client = RestTestClient.standaloneSetup(new TestController()).build();
|
||||
private final RestTestClient client = RestTestClient.bindToController(new TestController()).build();
|
||||
|
||||
@Test
|
||||
void requestResponseHeaderPair() {
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ import static org.hamcrest.Matchers.containsString;
|
||||
*/
|
||||
class JsonContentTests {
|
||||
|
||||
private final RestTestClient client = RestTestClient.standaloneSetup(new PersonController()).build();
|
||||
private final RestTestClient client = RestTestClient.bindToController(new PersonController()).build();
|
||||
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ import static org.hamcrest.Matchers.startsWith;
|
||||
* @author Rob Worsnop
|
||||
*/
|
||||
class ResponseEntityTests {
|
||||
private final RestTestClient client = RestTestClient.standaloneSetup(new PersonController())
|
||||
private final RestTestClient client = RestTestClient.bindToController(new PersonController())
|
||||
.baseUrl("/persons")
|
||||
.build();
|
||||
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ class RestTestClientTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
this.client = RestTestClient.standaloneSetup(new TestController()).build();
|
||||
this.client = RestTestClient.bindToController(new TestController()).build();
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
*/
|
||||
class SoftAssertionTests {
|
||||
|
||||
private final RestTestClient restTestClient = RestTestClient.standaloneSetup(new TestController()).build();
|
||||
private final RestTestClient restTestClient = RestTestClient.bindToController(new TestController()).build();
|
||||
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ class XmlContentTests {
|
||||
""";
|
||||
|
||||
|
||||
private final RestTestClient client = RestTestClient.standaloneSetup(new PersonController()).build();
|
||||
private final RestTestClient client = RestTestClient.bindToController(new PersonController()).build();
|
||||
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ class ControllerTests {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
this.client = RestTestClient.standaloneSetup(new TestController()).build();
|
||||
this.client = RestTestClient.bindToController(new TestController()).build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user