Rename Verifier to StepVerifier

Issue: SPR-14800
This commit is contained in:
Sebastien Deleuze
2016-11-02 19:01:40 +01:00
parent bb0d4c8ce0
commit 8705df502d
48 changed files with 203 additions and 204 deletions

View File

@@ -23,7 +23,7 @@ import org.junit.Before;
import org.junit.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -99,7 +99,7 @@ public class DispatcherHandlerErrorTests {
this.request.setUri("/does-not-exist");
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
Verifier.create(publisher)
StepVerifier.create(publisher)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(ResponseStatusException.class));
assertThat(error.getMessage(),
@@ -113,7 +113,7 @@ public class DispatcherHandlerErrorTests {
this.request.setUri("/unknown-argument-type");
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
Verifier.create(publisher)
StepVerifier.create(publisher)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(IllegalStateException.class));
assertThat(error.getMessage(), startsWith("No resolver for argument [0]"));
@@ -126,7 +126,7 @@ public class DispatcherHandlerErrorTests {
this.request.setUri("/error-signal");
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
Verifier.create(publisher)
StepVerifier.create(publisher)
.consumeErrorWith(error -> {
assertSame(EXCEPTION, error);
})
@@ -138,7 +138,7 @@ public class DispatcherHandlerErrorTests {
this.request.setUri("/raise-exception");
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
Verifier.<Void>create(publisher)
StepVerifier.<Void>create(publisher)
.consumeErrorWith(error -> {
assertSame(EXCEPTION, error);
})
@@ -150,7 +150,7 @@ public class DispatcherHandlerErrorTests {
this.request.setUri("/unknown-return-type");
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
Verifier.create(publisher)
StepVerifier.create(publisher)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(IllegalStateException.class));
assertThat(error.getMessage(), startsWith("No HandlerResultHandler"));
@@ -163,7 +163,7 @@ public class DispatcherHandlerErrorTests {
this.request.setUri("/request-body").setHeader("Accept", "application/json").setBody("body");
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
Verifier.create(publisher)
StepVerifier.create(publisher)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(NotAcceptableStatusException.class));
})
@@ -175,7 +175,7 @@ public class DispatcherHandlerErrorTests {
this.request.setUri("/request-body").setBody(Mono.error(EXCEPTION));
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
Verifier.create(publisher)
StepVerifier.create(publisher)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(ServerWebInputException.class));
assertSame(EXCEPTION, error.getCause());

View File

@@ -24,7 +24,7 @@ import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.context.support.GenericApplicationContext;
@@ -100,7 +100,7 @@ public class ResourceHandlerRegistryTests {
ResourceWebHandler handler = getHandler("/resources/**");
handler.handle(this.exchange).blockMillis(5000);
Verifier.create(this.response.getBody())
StepVerifier.create(this.response.getBody())
.consumeNextWith(buf -> assertEquals("test stylesheet content",
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
.expectComplete()

View File

@@ -23,7 +23,7 @@ import org.junit.Test;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.http.MediaType;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
@@ -74,7 +74,7 @@ public class SseHandlerFunctionIntegrationTests
.map(s -> (s.replace("\n", "")))
.take(2);
Verifier.create(result)
StepVerifier.create(result)
.expectNext("data:foo 0")
.expectNext("data:foo 1")
.expectComplete()
@@ -97,7 +97,7 @@ public class SseHandlerFunctionIntegrationTests
.takeUntil(s -> s.endsWith("foo 1\"}"))
.reduce((s1, s2) -> s1 + s2);
Verifier.create(result)
StepVerifier.create(result)
.expectNext("data:{\"name\":\"foo 0\"}data:{\"name\":\"foo 1\"}")
.expectComplete()
.verify(Duration.ofSeconds(5));
@@ -118,7 +118,7 @@ public class SseHandlerFunctionIntegrationTests
.map(s -> s.replace("\n", ""))
.take(2);
Verifier.create(result)
StepVerifier.create(result)
.expectNext("id:0:bardata:foo")
.expectNext("id:1:bardata:foo")
.expectComplete()

View File

@@ -28,7 +28,7 @@ import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
@@ -527,7 +527,7 @@ public class ResourceWebHandlerTests {
this.request.addHeader("Range", "bytes= foo bar");
this.exchange.getAttributes().put(PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, "foo.txt");
Verifier.create(this.handler.handle(this.exchange))
StepVerifier.create(this.handler.handle(this.exchange))
.expectNextCount(0)
.expectComplete()
.verify();
@@ -555,7 +555,7 @@ public class ResourceWebHandlerTests {
return previous;
});
Verifier.create(reduced)
StepVerifier.create(reduced)
.consumeNextWith(buf -> {
String content = DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8);
String[] ranges = StringUtils.tokenizeToStringArray(content, "\r\n", false, true);
@@ -598,7 +598,7 @@ public class ResourceWebHandlerTests {
}
private void assertResponseBody(String responseBody) {
Verifier.create(this.response.getBody())
StepVerifier.create(this.response.getBody())
.consumeNextWith(buf -> assertEquals(responseBody,
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
.expectComplete()

View File

@@ -26,7 +26,7 @@ import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.http.HttpMethod;
import org.springframework.http.server.reactive.ServerHttpRequest;
@@ -100,7 +100,7 @@ public class HandlerMethodMappingTests {
this.mapping.registerMapping("/fo?", this.handler, this.method2);
Mono<Object> result = this.mapping.getHandler(createExchange(HttpMethod.GET, "/foo"));
Verifier.create(result).expectError(IllegalStateException.class).verify();
StepVerifier.create(result).expectError(IllegalStateException.class).verify();
}
@Test

View File

@@ -21,7 +21,7 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.http.HttpMethod;
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
@@ -92,7 +92,7 @@ public class InvocableHandlerMethodTests {
InvocableHandlerMethod hm = handlerMethod("singleArg");
Mono<HandlerResult> mono = hm.invoke(this.exchange, new BindingContext());
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(IllegalStateException.class));
@@ -108,7 +108,7 @@ public class InvocableHandlerMethodTests {
addResolver(hm, Mono.error(new UnsupportedMediaTypeStatusException("boo")));
Mono<HandlerResult> mono = hm.invoke(this.exchange, new BindingContext());
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(UnsupportedMediaTypeStatusException.class));
@@ -123,7 +123,7 @@ public class InvocableHandlerMethodTests {
addResolver(hm, Mono.just(1));
Mono<HandlerResult> mono = hm.invoke(this.exchange, new BindingContext());
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(IllegalStateException.class));
@@ -139,7 +139,7 @@ public class InvocableHandlerMethodTests {
InvocableHandlerMethod hm = handlerMethod("exceptionMethod");
Mono<HandlerResult> mono = hm.invoke(this.exchange, new BindingContext());
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.consumeErrorWith(error -> {
assertThat(error, instanceOf(IllegalStateException.class));
@@ -162,7 +162,7 @@ public class InvocableHandlerMethodTests {
}
private void assertHandlerResultValue(Mono<HandlerResult> mono, String expected) {
Verifier.create(mono)
StepVerifier.create(mono)
.consumeNextWith(result -> {
Optional<?> optional = result.getReturnValue();
assertTrue(optional.isPresent());

View File

@@ -29,7 +29,7 @@ import java.util.function.Consumer;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.annotation.AnnotationUtils;
@@ -164,7 +164,7 @@ public class RequestMappingInfoHandlerMappingTests {
this.handlerMapping.registerHandler(new UserController());
Mono<Object> mono = this.handlerMapping.getHandler(exchange);
Verifier.create(mono)
StepVerifier.create(mono)
.expectError(NotAcceptableStatusException.class)
.verify();
}
@@ -353,7 +353,7 @@ public class RequestMappingInfoHandlerMappingTests {
@SuppressWarnings("unchecked")
private <T> void assertError(Mono<Object> mono, final Class<T> exceptionClass, final Consumer<T> consumer) {
Verifier.create(mono)
StepVerifier.create(mono)
.consumeErrorWith(error -> {
assertEquals(exceptionClass, error.getClass());
consumer.accept((T) error);

View File

@@ -21,7 +21,7 @@ import java.lang.reflect.Method;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.MethodParameter;
@@ -119,7 +119,7 @@ public class CookieValueMethodArgumentResolverTests {
@Test
public void notFound() {
Mono<Object> mono = resolver.resolveArgument(this.cookieParameter, this.bindingContext, this.exchange);
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();

View File

@@ -29,7 +29,7 @@ import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import rx.Observable;
import rx.RxReactiveStreams;
import rx.Single;
@@ -130,7 +130,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType type = httpEntityType(forClassWithGenerics(Mono.class, String.class));
HttpEntity<Mono<String>> entity = resolveValueWithEmptyBody(type);
Verifier.create(entity.getBody()).expectNextCount(0).expectComplete().verify();
StepVerifier.create(entity.getBody()).expectNextCount(0).expectComplete().verify();
}
@Test
@@ -138,7 +138,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType type = httpEntityType(forClassWithGenerics(Flux.class, String.class));
HttpEntity<Flux<String>> entity = resolveValueWithEmptyBody(type);
Verifier.create(entity.getBody()).expectNextCount(0).expectComplete().verify();
StepVerifier.create(entity.getBody()).expectNextCount(0).expectComplete().verify();
}
@Test
@@ -146,7 +146,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType type = httpEntityType(forClassWithGenerics(Single.class, String.class));
HttpEntity<Single<String>> entity = resolveValueWithEmptyBody(type);
Verifier.create(RxReactiveStreams.toPublisher(entity.getBody()))
StepVerifier.create(RxReactiveStreams.toPublisher(entity.getBody()))
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();
@@ -157,7 +157,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType type = httpEntityType(forClassWithGenerics(io.reactivex.Single.class, String.class));
HttpEntity<io.reactivex.Single<String>> entity = resolveValueWithEmptyBody(type);
Verifier.create(entity.getBody().toFlowable())
StepVerifier.create(entity.getBody().toFlowable())
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();
@@ -168,7 +168,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType type = httpEntityType(forClassWithGenerics(Maybe.class, String.class));
HttpEntity<Maybe<String>> entity = resolveValueWithEmptyBody(type);
Verifier.create(entity.getBody().toFlowable())
StepVerifier.create(entity.getBody().toFlowable())
.expectNextCount(0)
.expectComplete()
.verify();
@@ -179,7 +179,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType type = httpEntityType(forClassWithGenerics(Observable.class, String.class));
HttpEntity<Observable<String>> entity = resolveValueWithEmptyBody(type);
Verifier.create(RxReactiveStreams.toPublisher(entity.getBody()))
StepVerifier.create(RxReactiveStreams.toPublisher(entity.getBody()))
.expectNextCount(0)
.expectComplete()
.verify();
@@ -190,7 +190,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType type = httpEntityType(forClassWithGenerics(io.reactivex.Observable.class, String.class));
HttpEntity<io.reactivex.Observable<String>> entity = resolveValueWithEmptyBody(type);
Verifier.create(entity.getBody().toFlowable(BackpressureStrategy.BUFFER))
StepVerifier.create(entity.getBody().toFlowable(BackpressureStrategy.BUFFER))
.expectNextCount(0)
.expectComplete()
.verify();
@@ -201,7 +201,7 @@ public class HttpEntityArgumentResolverTests {
ResolvableType type = httpEntityType(forClassWithGenerics(Flowable.class, String.class));
HttpEntity<Flowable<String>> entity = resolveValueWithEmptyBody(type);
Verifier.create(entity.getBody())
StepVerifier.create(entity.getBody())
.expectNextCount(0)
.expectComplete()
.verify();
@@ -285,7 +285,7 @@ public class HttpEntityArgumentResolverTests {
HttpEntity<Flux<String>> httpEntity = resolveValue(type, body);
assertEquals(this.request.getHeaders(), httpEntity.getHeaders());
Verifier.create(httpEntity.getBody())
StepVerifier.create(httpEntity.getBody())
.expectNext("line1\n")
.expectNext("line2\n")
.expectNext("line3\n")

View File

@@ -34,7 +34,7 @@ import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import rx.Observable;
import rx.Single;
@@ -103,7 +103,7 @@ public class MessageReaderArgumentResolverTests {
MethodParameter param = this.testMethod.resolveParam(type);
Mono<Object> result = this.resolver.readBody(param, true, this.bindingContext, this.exchange);
Verifier.create(result).expectError(UnsupportedMediaTypeStatusException.class).verify();
StepVerifier.create(result).expectError(UnsupportedMediaTypeStatusException.class).verify();
}
// More extensive "empty body" tests in RequestBody- and HttpEntityArgumentResolverTests
@@ -116,7 +116,7 @@ public class MessageReaderArgumentResolverTests {
Mono<TestBean> result = (Mono<TestBean>) this.resolver.readBody(
param, true, this.bindingContext, this.exchange).block();
Verifier.create(result).expectError(ServerWebInputException.class).verify();
StepVerifier.create(result).expectError(ServerWebInputException.class).verify();
}
@Test
@@ -273,7 +273,7 @@ public class MessageReaderArgumentResolverTests {
MethodParameter param = this.testMethod.resolveParam(type);
Mono<TestBean> mono = resolveValue(param, body);
Verifier.create(mono).expectNextCount(0).expectError(ServerWebInputException.class).verify();
StepVerifier.create(mono).expectNextCount(0).expectError(ServerWebInputException.class).verify();
}
@Test @SuppressWarnings("unchecked")
@@ -283,7 +283,7 @@ public class MessageReaderArgumentResolverTests {
MethodParameter param = this.testMethod.resolveParam(type);
Flux<TestBean> flux = resolveValue(param, body);
Verifier.create(flux)
StepVerifier.create(flux)
.expectNext(new TestBean("f1", "b1"))
.expectError(ServerWebInputException.class)
.verify();

View File

@@ -33,7 +33,7 @@ import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import rx.Completable;
import rx.Observable;
@@ -137,7 +137,7 @@ public class MessageWriterResultHandlerTests {
HttpMessageWriter<?> writer = new EncoderHttpMessageWriter<>(new ByteBufferEncoder());
Mono<Void> mono = createResultHandler(writer).writeBody(body, returnType(type), this.exchange);
Verifier.create(mono).expectError(IllegalStateException.class).verify();
StepVerifier.create(mono).expectError(IllegalStateException.class).verify();
}
@Test // SPR-12811
@@ -194,7 +194,7 @@ public class MessageWriterResultHandlerTests {
}
private void assertResponseBody(String responseBody) {
Verifier.create(this.response.getBody())
StepVerifier.create(this.response.getBody())
.consumeNextWith(buf -> assertEquals(responseBody,
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
.expectComplete()

View File

@@ -24,7 +24,7 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.core.MethodParameter;
import org.springframework.core.annotation.SynthesizingMethodParameter;
@@ -134,7 +134,7 @@ public class PathVariableMethodArgumentResolverTests {
public void handleMissingValue() throws Exception {
BindingContext bindingContext = new BindingContext();
Mono<Object> mono = this.resolver.resolveArgument(this.paramNamedString, bindingContext, this.exchange);
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.expectError(ServerErrorException.class)
.verify();
@@ -144,8 +144,7 @@ public class PathVariableMethodArgumentResolverTests {
public void nullIfNotRequired() throws Exception {
BindingContext bindingContext = new BindingContext();
Mono<Object> mono = this.resolver.resolveArgument(this.paramNotRequired, bindingContext, this.exchange);
Verifier
.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.expectComplete()
.verify();
@@ -156,7 +155,7 @@ public class PathVariableMethodArgumentResolverTests {
BindingContext bindingContext = new BindingContext();
Mono<Object> mono = this.resolver.resolveArgument(this.paramOptional, bindingContext, this.exchange);
Verifier.create(mono)
StepVerifier.create(mono)
.consumeNextWith(value -> {
assertTrue(value instanceof Optional);
assertFalse(((Optional) value).isPresent());

View File

@@ -21,7 +21,7 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.DefaultParameterNameDiscoverer;
@@ -89,7 +89,7 @@ public class RequestAttributeMethodArgumentResolverTests {
public void resolve() throws Exception {
MethodParameter param = initMethodParameter(0);
Mono<Object> mono = this.resolver.resolveArgument(param, new BindingContext(), this.exchange);
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();

View File

@@ -27,7 +27,7 @@ import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import rx.Observable;
import rx.RxReactiveStreams;
import rx.Single;
@@ -126,12 +126,12 @@ public class RequestBodyArgumentResolverTests {
public void emptyBodyWithMono() throws Exception {
ResolvableType type = forClassWithGenerics(Mono.class, String.class);
Verifier.create((Mono<Void>) resolveValueWithEmptyBody(type, true))
StepVerifier.create((Mono<Void>) resolveValueWithEmptyBody(type, true))
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();
Verifier.create((Mono<Void>) resolveValueWithEmptyBody(type, false))
StepVerifier.create((Mono<Void>) resolveValueWithEmptyBody(type, false))
.expectNextCount(0)
.expectComplete()
.verify();
@@ -142,12 +142,12 @@ public class RequestBodyArgumentResolverTests {
public void emptyBodyWithFlux() throws Exception {
ResolvableType type = forClassWithGenerics(Flux.class, String.class);
Verifier.create((Flux<Void>) resolveValueWithEmptyBody(type, true))
StepVerifier.create((Flux<Void>) resolveValueWithEmptyBody(type, true))
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();
Verifier.create((Flux<Void>) resolveValueWithEmptyBody(type, false))
StepVerifier.create((Flux<Void>) resolveValueWithEmptyBody(type, false))
.expectNextCount(0)
.expectComplete()
.verify();
@@ -158,13 +158,13 @@ public class RequestBodyArgumentResolverTests {
ResolvableType type = forClassWithGenerics(Single.class, String.class);
Single<String> single = resolveValueWithEmptyBody(type, true);
Verifier.create(RxReactiveStreams.toPublisher(single))
StepVerifier.create(RxReactiveStreams.toPublisher(single))
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();
single = resolveValueWithEmptyBody(type, false);
Verifier.create(RxReactiveStreams.toPublisher(single))
StepVerifier.create(RxReactiveStreams.toPublisher(single))
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();
@@ -175,13 +175,13 @@ public class RequestBodyArgumentResolverTests {
ResolvableType type = forClassWithGenerics(Maybe.class, String.class);
Maybe<String> maybe = resolveValueWithEmptyBody(type, true);
Verifier.create(maybe.toFlowable())
StepVerifier.create(maybe.toFlowable())
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();
maybe = resolveValueWithEmptyBody(type, false);
Verifier.create(maybe.toFlowable())
StepVerifier.create(maybe.toFlowable())
.expectNextCount(0)
.expectComplete()
.verify();
@@ -192,13 +192,13 @@ public class RequestBodyArgumentResolverTests {
ResolvableType type = forClassWithGenerics(Observable.class, String.class);
Observable<String> observable = resolveValueWithEmptyBody(type, true);
Verifier.create(RxReactiveStreams.toPublisher(observable))
StepVerifier.create(RxReactiveStreams.toPublisher(observable))
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();
observable = resolveValueWithEmptyBody(type, false);
Verifier.create(RxReactiveStreams.toPublisher(observable))
StepVerifier.create(RxReactiveStreams.toPublisher(observable))
.expectNextCount(0)
.expectComplete()
.verify();

View File

@@ -26,7 +26,7 @@ import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.MethodParameter;
@@ -203,7 +203,7 @@ public class RequestHeaderMethodArgumentResolverTests {
Mono<Object> mono = resolver.resolveArgument(
this.paramNamedValueStringArray, this.bindingContext, this.exchange);
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();

View File

@@ -24,7 +24,7 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.MethodParameter;
@@ -159,7 +159,7 @@ public class RequestParamMethodArgumentResolverTests {
Mono<Object> mono = this.resolver.resolveArgument(
this.paramNamedStringArray, this.bindingContext, this.exchange);
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.expectError(ServerWebInputException.class)
.verify();

View File

@@ -29,7 +29,7 @@ import java.util.concurrent.CompletableFuture;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import rx.Completable;
import rx.Single;
@@ -291,7 +291,7 @@ public class ResponseEntityResultHandlerTests {
}
private void assertResponseBody(String responseBody) {
Verifier.create(this.response.getBody())
StepVerifier.create(this.response.getBody())
.consumeNextWith(buf -> assertEquals(responseBody,
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
.expectComplete()

View File

@@ -21,7 +21,7 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.DefaultParameterNameDiscoverer;
@@ -96,7 +96,7 @@ public class SessionAttributeMethodArgumentResolverTests {
public void resolve() throws Exception {
MethodParameter param = initMethodParameter(0);
Mono<Object> mono = this.resolver.resolveArgument(param, new BindingContext(), this.exchange);
Verifier.create(mono).expectError(ServerWebInputException.class).verify();
StepVerifier.create(mono).expectError(ServerWebInputException.class).verify();
Foo foo = new Foo();
when(this.session.getAttribute("foo")).thenReturn(Optional.of(foo));

View File

@@ -32,7 +32,7 @@ import org.springframework.http.codec.BodyExtractors;
import org.springframework.http.codec.ServerSentEvent;
import org.springframework.http.server.reactive.AbstractHttpHandlerIntegrationTests;
import org.springframework.http.server.reactive.HttpHandler;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.reactive.ClientRequest;
@@ -87,7 +87,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
.map(s -> (s.replace("\n", "")))
.take(2);
Verifier.create(result)
StepVerifier.create(result)
.expectNext("data:foo 0")
.expectNext("data:foo 1")
.expectComplete()
@@ -109,7 +109,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
.takeUntil(s -> s.endsWith("foo 1\"}"))
.reduce((s1, s2) -> s1 + s2);
Verifier.create(result)
StepVerifier.create(result)
.expectNext("data:{\"name\":\"foo 0\"}data:{\"name\":\"foo 1\"}")
.expectComplete()
.verify(Duration.ofSeconds(5L));
@@ -129,7 +129,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
.map(s -> s.replace("\n", ""))
.take(2);
Verifier.create(result)
StepVerifier.create(result)
.expectNext("id:0:bardata:foo")
.expectNext("id:1:bardata:foo")
.expectComplete()
@@ -151,7 +151,7 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
.map(s -> s.replace("\n", ""))
.take(2);
Verifier.create(result)
StepVerifier.create(result)
.expectNext("id:0:bardata:foo")
.expectNext("id:1:bardata:foo")
.expectComplete()

View File

@@ -26,7 +26,7 @@ import java.util.List;
import java.util.Map;
import org.junit.Test;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.core.codec.CharSequenceEncoder;
import org.springframework.core.io.buffer.DataBuffer;
@@ -155,7 +155,7 @@ public class HttpMessageWriterViewTests {
this.view.render(this.model, MediaType.APPLICATION_JSON, exchange);
Verifier.create(response.getBody())
StepVerifier.create(response.getBody())
.consumeNextWith( buf -> assertEquals("{\"foo\":\"f\",\"bar\":\"b\"}",
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8))
)

View File

@@ -31,7 +31,7 @@ import org.junit.Before;
import org.junit.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import rx.Completable;
import rx.Single;
@@ -204,7 +204,7 @@ public class ViewResolutionResultHandlerTests {
this.request.setUri("/path");
Mono<Void> mono = createResultHandler().handleResult(this.exchange, handlerResult);
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.expectErrorWith(err -> err.getMessage().equals("Could not resolve view with name 'account'."))
.verify();
@@ -240,7 +240,7 @@ public class ViewResolutionResultHandlerTests {
ViewResolutionResultHandler resultHandler = createResultHandler(new TestViewResolver("account"));
Mono<Void> mono = resultHandler.handleResult(this.exchange, handlerResult);
Verifier.create(mono)
StepVerifier.create(mono)
.expectNextCount(0)
.expectError(NotAcceptableStatusException.class)
.verify();
@@ -293,7 +293,7 @@ public class ViewResolutionResultHandlerTests {
}
private void assertResponseBody(String responseBody) {
Verifier.create(this.response.getBody())
StepVerifier.create(this.response.getBody())
.consumeNextWith(buf -> assertEquals(responseBody,
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
.expectComplete()

View File

@@ -25,7 +25,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import reactor.test.subscriber.Verifier;
import reactor.test.StepVerifier;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.support.GenericApplicationContext;
@@ -123,7 +123,7 @@ public class FreeMarkerViewTests {
model.addAttribute("hello", "hi FreeMarker");
view.render(model, null, this.exchange);
Verifier.create(this.response.getBody())
StepVerifier.create(this.response.getBody())
.consumeNextWith(buf -> {
assertEquals("<html><body>hi FreeMarker</body></html>", asString(buf));
})