Rename fromObject to fromValue in BodyInserters
Closes gh-23587
This commit is contained in:
@@ -117,7 +117,7 @@ public class BodyInsertersTests {
|
||||
@Test
|
||||
public void ofString() {
|
||||
String body = "foo";
|
||||
BodyInserter<String, ReactiveHttpOutputMessage> inserter = BodyInserters.fromObject(body);
|
||||
BodyInserter<String, ReactiveHttpOutputMessage> inserter = BodyInserters.fromValue(body);
|
||||
|
||||
MockServerHttpResponse response = new MockServerHttpResponse();
|
||||
Mono<Void> result = inserter.insert(response, this.context);
|
||||
@@ -134,7 +134,7 @@ public class BodyInsertersTests {
|
||||
@Test
|
||||
public void ofObject() {
|
||||
User body = new User("foo", "bar");
|
||||
BodyInserter<User, ReactiveHttpOutputMessage> inserter = BodyInserters.fromObject(body);
|
||||
BodyInserter<User, ReactiveHttpOutputMessage> inserter = BodyInserters.fromValue(body);
|
||||
MockServerHttpResponse response = new MockServerHttpResponse();
|
||||
Mono<Void> result = inserter.insert(response, this.context);
|
||||
StepVerifier.create(result).expectComplete().verify();
|
||||
@@ -148,7 +148,7 @@ public class BodyInsertersTests {
|
||||
@Test
|
||||
public void ofObjectWithHints() {
|
||||
User body = new User("foo", "bar");
|
||||
BodyInserter<User, ReactiveHttpOutputMessage> inserter = BodyInserters.fromObject(body);
|
||||
BodyInserter<User, ReactiveHttpOutputMessage> inserter = BodyInserters.fromValue(body);
|
||||
this.hints.put(JSON_VIEW_HINT, SafeToSerialize.class);
|
||||
MockServerHttpResponse response = new MockServerHttpResponse();
|
||||
Mono<Void> result = inserter.insert(response, this.context);
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.springframework.mock.http.server.reactive.test.MockServerHttpResponse
|
||||
import org.springframework.mock.web.test.server.MockServerWebExchange;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
import org.springframework.web.reactive.result.view.ViewResolver;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -315,7 +314,7 @@ public class DefaultServerResponseBuilderTests {
|
||||
|
||||
serverResponse = ServerResponse.ok()
|
||||
.cookie(ResponseCookie.from("foo", "bar").build())
|
||||
.body(BodyInserters.fromObject("body"));
|
||||
.bodyValue("body");
|
||||
|
||||
|
||||
assertThat(serverResponse.block().cookies().isEmpty()).isFalse();
|
||||
|
||||
@@ -21,7 +21,6 @@ import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
@@ -49,7 +48,7 @@ public class RouterFunctionTests {
|
||||
@Test
|
||||
public void andOther() {
|
||||
HandlerFunction<ServerResponse> handlerFunction =
|
||||
request -> ServerResponse.ok().body(fromObject("42"));
|
||||
request -> ServerResponse.ok().bodyValue("42");
|
||||
RouterFunction<?> routerFunction1 = request -> Mono.empty();
|
||||
RouterFunction<ServerResponse> routerFunction2 =
|
||||
request -> Mono.just(handlerFunction);
|
||||
@@ -120,7 +119,7 @@ public class RouterFunctionTests {
|
||||
|
||||
|
||||
private Mono<ServerResponse> handlerMethod(ServerRequest request) {
|
||||
return ServerResponse.ok().body(fromObject("42"));
|
||||
return ServerResponse.ok().bodyValue("42");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user