Rename BodyInsertor to BodyInserter

This commit is contained in:
Arjen Poutsma
2016-09-17 15:58:15 +02:00
parent b6035ce9ae
commit 778ef02680
10 changed files with 87 additions and 86 deletions

View File

@@ -38,17 +38,17 @@ import static org.junit.Assert.assertEquals;
/**
* @author Arjen Poutsma
*/
public class BodyInsertorsTests {
public class BodyInsertersTests {
@Test
public void ofObject() throws Exception {
String body = "foo";
BodyInsertor<String> insertor = BodyInsertors.fromObject(body);
BodyInserter<String> inserter = BodyInserters.fromObject(body);
assertEquals(body, insertor.t());
assertEquals(body, inserter.t());
MockServerHttpResponse response = new MockServerHttpResponse();
Mono<Void> result = insertor.insert(response, Configuration.builder().build());
Mono<Void> result = inserter.insert(response, Configuration.builder().build());
TestSubscriber.subscribe(result)
.assertComplete();
@@ -62,12 +62,12 @@ public class BodyInsertorsTests {
@Test
public void ofPublisher() throws Exception {
Flux<String> body = Flux.just("foo");
BodyInsertor<Flux<String>> insertor = BodyInsertors.fromPublisher(body, String.class);
BodyInserter<Flux<String>> inserter = BodyInserters.fromPublisher(body, String.class);
assertEquals(body, insertor.t());
assertEquals(body, inserter.t());
MockServerHttpResponse response = new MockServerHttpResponse();
Mono<Void> result = insertor.insert(response, Configuration.builder().build());
Mono<Void> result = inserter.insert(response, Configuration.builder().build());
TestSubscriber.subscribe(result)
.assertComplete();
@@ -81,12 +81,12 @@ public class BodyInsertorsTests {
@Test
public void ofResource() throws Exception {
Resource body = new ClassPathResource("response.txt", getClass());
BodyInsertor<Resource> insertor = BodyInsertors.fromResource(body);
BodyInserter<Resource> inserter = BodyInserters.fromResource(body);
assertEquals(body, insertor.t());
assertEquals(body, inserter.t());
MockServerHttpResponse response = new MockServerHttpResponse();
Mono<Void> result = insertor.insert(response, Configuration.builder().build());
Mono<Void> result = inserter.insert(response, Configuration.builder().build());
TestSubscriber.subscribe(result)
.assertComplete();
@@ -105,13 +105,13 @@ public class BodyInsertorsTests {
public void ofServerSentEventFlux() throws Exception {
ServerSentEvent<String> event = ServerSentEvent.builder("foo").build();
Flux<ServerSentEvent<String>> body = Flux.just(event);
BodyInsertor<Flux<ServerSentEvent<String>>> insertor =
BodyInsertors.fromServerSentEvents(body);
BodyInserter<Flux<ServerSentEvent<String>>> inserter =
BodyInserters.fromServerSentEvents(body);
assertEquals(body, insertor.t());
assertEquals(body, inserter.t());
MockServerHttpResponse response = new MockServerHttpResponse();
Mono<Void> result = insertor.insert(response, Configuration.builder().build());
Mono<Void> result = inserter.insert(response, Configuration.builder().build());
TestSubscriber.subscribe(result)
.assertComplete();
@@ -120,13 +120,13 @@ public class BodyInsertorsTests {
@Test
public void ofServerSentEventClass() throws Exception {
Flux<String> body = Flux.just("foo");
BodyInsertor<Flux<String>> insertor =
BodyInsertors.fromServerSentEvents(body, String.class);
BodyInserter<Flux<String>> inserter =
BodyInserters.fromServerSentEvents(body, String.class);
assertEquals(body, insertor.t());
assertEquals(body, inserter.t());
MockServerHttpResponse response = new MockServerHttpResponse();
Mono<Void> result = insertor.insert(response, Configuration.builder().build());
Mono<Void> result = inserter.insert(response, Configuration.builder().build());
TestSubscriber.subscribe(result)
.assertComplete();

View File

@@ -214,7 +214,7 @@ public class DefaultResponseBuilderTests {
}
@Test
public void bodyInsertor() throws Exception {
public void bodyInserter() throws Exception {
String body = "foo";
Supplier<String> supplier = () -> body;
BiFunction<ServerHttpResponse, Configuration, Mono<Void>> writer =

View File

@@ -155,14 +155,14 @@ public class DispatcherHandlerIntegrationTests extends AbstractHttpHandlerIntegr
public Response<Publisher<Person>> mono(Request request) {
Person person = new Person("John");
return Response.ok().body(BodyInsertors.fromPublisher(Mono.just(person), Person.class));
return Response.ok().body(BodyInserters.fromPublisher(Mono.just(person), Person.class));
}
public Response<Publisher<Person>> flux(Request request) {
Person person1 = new Person("John");
Person person2 = new Person("Jane");
return Response.ok().body(
BodyInsertors.fromPublisher(Flux.just(person1, person2), Person.class));
BodyInserters.fromPublisher(Flux.just(person1, person2), Person.class));
}
}

View File

@@ -34,7 +34,7 @@ import org.springframework.web.client.RestTemplate;
import static org.junit.Assert.assertEquals;
import static org.springframework.web.reactive.function.BodyExtractors.toMono;
import static org.springframework.web.reactive.function.BodyInsertors.fromPublisher;
import static org.springframework.web.reactive.function.BodyInserters.fromPublisher;
import static org.springframework.web.reactive.function.RequestPredicates.GET;
import static org.springframework.web.reactive.function.RequestPredicates.POST;
import static org.springframework.web.reactive.function.RouterFunctions.route;

View File

@@ -23,7 +23,7 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.springframework.web.reactive.function.BodyInsertors.fromObject;
import static org.springframework.web.reactive.function.BodyInserters.fromObject;
/**
* @author Arjen Poutsma

View File

@@ -111,13 +111,13 @@ public class SseHandlerFunctionIntegrationTests
public Response<Publisher<String>> string(Request request) {
Flux<String> flux = Flux.interval(Duration.ofMillis(100)).map(l -> "foo " + l).take(2);
return Response.ok().body(BodyInsertors.fromServerSentEvents(flux, String.class));
return Response.ok().body(BodyInserters.fromServerSentEvents(flux, String.class));
}
public Response<Publisher<Person>> person(Request request) {
Flux<Person> flux = Flux.interval(Duration.ofMillis(100))
.map(l -> new Person("foo " + l)).take(2);
return Response.ok().body(BodyInsertors.fromServerSentEvents(flux, Person.class));
return Response.ok().body(BodyInserters.fromServerSentEvents(flux, Person.class));
}
public Response<Publisher<ServerSentEvent<String>>> sse(Request request) {
@@ -127,7 +127,7 @@ public class SseHandlerFunctionIntegrationTests
.comment("bar")
.build()).take(2);
return Response.ok().body(BodyInsertors.fromServerSentEvents(flux));
return Response.ok().body(BodyInserters.fromServerSentEvents(flux));
}
}