Update tests according to latest reactor-test changes
- ScriptedSubscriber has been renamed to Verifier - The Publisher is passed to create() instead of verify() - No more need to specify the generic type explicitly - Version is now sync with reactor-core Issue: SPR-14800
This commit is contained in:
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -99,13 +99,13 @@ public class DispatcherHandlerErrorTests {
|
||||
this.request.setUri("/does-not-exist");
|
||||
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
|
||||
|
||||
ScriptedSubscriber.<Void>create()
|
||||
Verifier.create(publisher)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(ResponseStatusException.class));
|
||||
assertThat(error.getMessage(),
|
||||
is("Request failure [status: 404, reason: \"No matching handler\"]"));
|
||||
})
|
||||
.verify(publisher);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -113,12 +113,12 @@ public class DispatcherHandlerErrorTests {
|
||||
this.request.setUri("/unknown-argument-type");
|
||||
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
|
||||
|
||||
ScriptedSubscriber.<Void>create()
|
||||
Verifier.create(publisher)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(IllegalStateException.class));
|
||||
assertThat(error.getMessage(), startsWith("No resolver for argument [0]"));
|
||||
})
|
||||
.verify(publisher);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -126,11 +126,11 @@ public class DispatcherHandlerErrorTests {
|
||||
this.request.setUri("/error-signal");
|
||||
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
|
||||
|
||||
ScriptedSubscriber.<Void>create()
|
||||
Verifier.create(publisher)
|
||||
.consumeErrorWith(error -> {
|
||||
assertSame(EXCEPTION, error);
|
||||
})
|
||||
.verify(publisher);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -138,11 +138,11 @@ public class DispatcherHandlerErrorTests {
|
||||
this.request.setUri("/raise-exception");
|
||||
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
|
||||
|
||||
ScriptedSubscriber.<Void>create()
|
||||
Verifier.<Void>create(publisher)
|
||||
.consumeErrorWith(error -> {
|
||||
assertSame(EXCEPTION, error);
|
||||
})
|
||||
.verify(publisher);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -150,12 +150,12 @@ public class DispatcherHandlerErrorTests {
|
||||
this.request.setUri("/unknown-return-type");
|
||||
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
|
||||
|
||||
ScriptedSubscriber.<Void>create()
|
||||
Verifier.create(publisher)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(IllegalStateException.class));
|
||||
assertThat(error.getMessage(), startsWith("No HandlerResultHandler"));
|
||||
})
|
||||
.verify(publisher);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -163,11 +163,11 @@ public class DispatcherHandlerErrorTests {
|
||||
this.request.setUri("/request-body").setHeader("Accept", "application/json").setBody("body");
|
||||
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
|
||||
|
||||
ScriptedSubscriber.<Void>create()
|
||||
Verifier.create(publisher)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(NotAcceptableStatusException.class));
|
||||
})
|
||||
.verify(publisher);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -175,12 +175,12 @@ public class DispatcherHandlerErrorTests {
|
||||
this.request.setUri("/request-body").setBody(Mono.error(EXCEPTION));
|
||||
Mono<Void> publisher = this.dispatcherHandler.handle(this.exchange);
|
||||
|
||||
ScriptedSubscriber.<Void>create()
|
||||
Verifier.create(publisher)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(ServerWebInputException.class));
|
||||
assertSame(EXCEPTION, error.getCause());
|
||||
})
|
||||
.verify(publisher);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import reactor.test.subscriber.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCache;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
@@ -100,11 +100,11 @@ public class ResourceHandlerRegistryTests {
|
||||
ResourceWebHandler handler = getHandler("/resources/**");
|
||||
handler.handle(this.exchange).blockMillis(5000);
|
||||
|
||||
ScriptedSubscriber.<DataBuffer>create()
|
||||
Verifier.create(this.response.getBody())
|
||||
.consumeNextWith(buf -> assertEquals("test stylesheet content",
|
||||
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
|
||||
.expectComplete()
|
||||
.verify(this.response.getBody());
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
|
||||
@@ -74,11 +74,11 @@ public class SseHandlerFunctionIntegrationTests
|
||||
.map(s -> (s.replace("\n", "")))
|
||||
.take(2);
|
||||
|
||||
ScriptedSubscriber.<String>create()
|
||||
Verifier.create(result)
|
||||
.expectNext("data:foo 0")
|
||||
.expectNext("data:foo 1")
|
||||
.expectComplete()
|
||||
.verify(result, Duration.ofSeconds(5));
|
||||
.verify(Duration.ofSeconds(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -97,10 +97,10 @@ public class SseHandlerFunctionIntegrationTests
|
||||
.takeUntil(s -> s.endsWith("foo 1\"}"))
|
||||
.reduce((s1, s2) -> s1 + s2);
|
||||
|
||||
ScriptedSubscriber.<String>create()
|
||||
Verifier.create(result)
|
||||
.expectNext("data:{\"name\":\"foo 0\"}data:{\"name\":\"foo 1\"}")
|
||||
.expectComplete()
|
||||
.verify(result, Duration.ofSeconds(5));
|
||||
.verify(Duration.ofSeconds(5));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -118,11 +118,11 @@ public class SseHandlerFunctionIntegrationTests
|
||||
.map(s -> s.replace("\n", ""))
|
||||
.take(2);
|
||||
|
||||
ScriptedSubscriber.<String>create()
|
||||
Verifier.create(result)
|
||||
.expectNext("id:0:bardata:foo")
|
||||
.expectNext("id:1:bardata:foo")
|
||||
.expectComplete()
|
||||
.verify(result, Duration.ofSeconds(5));
|
||||
.verify(Duration.ofSeconds(5));
|
||||
}
|
||||
|
||||
private static class SseHandler {
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -527,10 +527,10 @@ public class ResourceWebHandlerTests {
|
||||
this.request.addHeader("Range", "bytes= foo bar");
|
||||
this.exchange.getAttributes().put(PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, "foo.txt");
|
||||
|
||||
ScriptedSubscriber.create()
|
||||
Verifier.create(this.handler.handle(this.exchange))
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify(this.handler.handle(this.exchange));
|
||||
.verify();
|
||||
|
||||
assertEquals(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE, this.response.getStatusCode());
|
||||
assertEquals("bytes", this.response.getHeaders().getFirst("Accept-Ranges"));
|
||||
@@ -555,7 +555,7 @@ public class ResourceWebHandlerTests {
|
||||
return previous;
|
||||
});
|
||||
|
||||
ScriptedSubscriber.<DataBuffer>create()
|
||||
Verifier.create(reduced)
|
||||
.consumeNextWith(buf -> {
|
||||
String content = DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8);
|
||||
String[] ranges = StringUtils.tokenizeToStringArray(content, "\r\n", false, true);
|
||||
@@ -576,7 +576,7 @@ public class ResourceWebHandlerTests {
|
||||
assertEquals("t.", ranges[11]);
|
||||
})
|
||||
.expectComplete()
|
||||
.verify(reduced);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test // SPR-14005
|
||||
@@ -598,11 +598,11 @@ public class ResourceWebHandlerTests {
|
||||
}
|
||||
|
||||
private void assertResponseBody(String responseBody) {
|
||||
ScriptedSubscriber.<DataBuffer>create()
|
||||
Verifier.create(this.response.getBody())
|
||||
.consumeNextWith(buf -> assertEquals(responseBody,
|
||||
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
|
||||
.expectComplete()
|
||||
.verify(this.response.getBody());
|
||||
.verify();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
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"));
|
||||
|
||||
ScriptedSubscriber.create().expectError(IllegalStateException.class).verify(result);
|
||||
Verifier.create(result).expectError(IllegalStateException.class).verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.mock.http.server.reactive.test.MockServerHttpRequest;
|
||||
@@ -92,13 +92,14 @@ public class InvocableHandlerMethodTests {
|
||||
InvocableHandlerMethod hm = handlerMethod("singleArg");
|
||||
Mono<HandlerResult> mono = hm.invoke(this.exchange, new BindingContext());
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(IllegalStateException.class));
|
||||
assertThat(error.getMessage(), is("No resolver for argument [0] of type [java.lang.String] " +
|
||||
"on method [" + hm.getMethod().toGenericString() + "]"));
|
||||
})
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -107,12 +108,13 @@ public class InvocableHandlerMethodTests {
|
||||
addResolver(hm, Mono.error(new UnsupportedMediaTypeStatusException("boo")));
|
||||
Mono<HandlerResult> mono = hm.invoke(this.exchange, new BindingContext());
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(UnsupportedMediaTypeStatusException.class));
|
||||
assertThat(error.getMessage(), is("Request failure [status: 415, reason: \"boo\"]"));
|
||||
})
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -121,14 +123,15 @@ public class InvocableHandlerMethodTests {
|
||||
addResolver(hm, Mono.just(1));
|
||||
Mono<HandlerResult> mono = hm.invoke(this.exchange, new BindingContext());
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(IllegalStateException.class));
|
||||
assertThat(error.getMessage(), is("Failed to invoke controller with resolved arguments: " +
|
||||
"[0][type=java.lang.Integer][value=1] " +
|
||||
"on method [" + hm.getMethod().toGenericString() + "]"));
|
||||
})
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -136,12 +139,13 @@ public class InvocableHandlerMethodTests {
|
||||
InvocableHandlerMethod hm = handlerMethod("exceptionMethod");
|
||||
Mono<HandlerResult> mono = hm.invoke(this.exchange, new BindingContext());
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.consumeErrorWith(error -> {
|
||||
assertThat(error, instanceOf(IllegalStateException.class));
|
||||
assertThat(error.getMessage(), is("boo"));
|
||||
})
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -158,14 +162,14 @@ public class InvocableHandlerMethodTests {
|
||||
}
|
||||
|
||||
private void assertHandlerResultValue(Mono<HandlerResult> mono, String expected) {
|
||||
ScriptedSubscriber.<HandlerResult>create()
|
||||
Verifier.create(mono)
|
||||
.consumeNextWith(result -> {
|
||||
Optional<?> optional = result.getReturnValue();
|
||||
assertTrue(optional.isPresent());
|
||||
assertEquals(expected, optional.get());
|
||||
})
|
||||
.expectComplete()
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
@@ -164,9 +164,9 @@ public class RequestMappingInfoHandlerMappingTests {
|
||||
this.handlerMapping.registerHandler(new UserController());
|
||||
Mono<Object> mono = this.handlerMapping.getHandler(exchange);
|
||||
|
||||
ScriptedSubscriber.<Object>create()
|
||||
Verifier.create(mono)
|
||||
.expectError(NotAcceptableStatusException.class)
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test // SPR-8462
|
||||
@@ -353,13 +353,13 @@ public class RequestMappingInfoHandlerMappingTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> void assertError(Mono<Object> mono, final Class<T> exceptionClass, final Consumer<T> consumer) {
|
||||
|
||||
ScriptedSubscriber.<Object>create()
|
||||
Verifier.create(mono)
|
||||
.consumeErrorWith(error -> {
|
||||
assertEquals(exceptionClass, error.getClass());
|
||||
consumer.accept((T) error);
|
||||
|
||||
})
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.core.MethodParameter;
|
||||
@@ -119,10 +119,10 @@ public class CookieValueMethodArgumentResolverTests {
|
||||
@Test
|
||||
public void notFound() {
|
||||
Mono<Object> mono = resolver.resolveArgument(this.cookieParameter, this.bindingContext, this.exchange);
|
||||
ScriptedSubscriber.create()
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
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);
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0).expectComplete().verify(entity.getBody());
|
||||
Verifier.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);
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0).expectComplete().verify(entity.getBody());
|
||||
Verifier.create(entity.getBody()).expectNextCount(0).expectComplete().verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -146,10 +146,10 @@ public class HttpEntityArgumentResolverTests {
|
||||
ResolvableType type = httpEntityType(forClassWithGenerics(Single.class, String.class));
|
||||
HttpEntity<Single<String>> entity = resolveValueWithEmptyBody(type);
|
||||
|
||||
ScriptedSubscriber
|
||||
.create().expectNextCount(0)
|
||||
Verifier.create(RxReactiveStreams.toPublisher(entity.getBody()))
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(RxReactiveStreams.toPublisher(entity.getBody()));
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -157,10 +157,10 @@ public class HttpEntityArgumentResolverTests {
|
||||
ResolvableType type = httpEntityType(forClassWithGenerics(io.reactivex.Single.class, String.class));
|
||||
HttpEntity<io.reactivex.Single<String>> entity = resolveValueWithEmptyBody(type);
|
||||
|
||||
ScriptedSubscriber
|
||||
.create().expectNextCount(0)
|
||||
Verifier.create(entity.getBody().toFlowable())
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(entity.getBody().toFlowable());
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -168,10 +168,10 @@ public class HttpEntityArgumentResolverTests {
|
||||
ResolvableType type = httpEntityType(forClassWithGenerics(Maybe.class, String.class));
|
||||
HttpEntity<Maybe<String>> entity = resolveValueWithEmptyBody(type);
|
||||
|
||||
ScriptedSubscriber
|
||||
.create().expectNextCount(0)
|
||||
Verifier.create(entity.getBody().toFlowable())
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify(entity.getBody().toFlowable());
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -179,10 +179,10 @@ public class HttpEntityArgumentResolverTests {
|
||||
ResolvableType type = httpEntityType(forClassWithGenerics(Observable.class, String.class));
|
||||
HttpEntity<Observable<String>> entity = resolveValueWithEmptyBody(type);
|
||||
|
||||
ScriptedSubscriber
|
||||
.create().expectNextCount(0)
|
||||
Verifier.create(RxReactiveStreams.toPublisher(entity.getBody()))
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify(RxReactiveStreams.toPublisher(entity.getBody()));
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -190,10 +190,10 @@ public class HttpEntityArgumentResolverTests {
|
||||
ResolvableType type = httpEntityType(forClassWithGenerics(io.reactivex.Observable.class, String.class));
|
||||
HttpEntity<io.reactivex.Observable<String>> entity = resolveValueWithEmptyBody(type);
|
||||
|
||||
ScriptedSubscriber
|
||||
.create().expectNextCount(0)
|
||||
Verifier.create(entity.getBody().toFlowable(BackpressureStrategy.BUFFER))
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify(entity.getBody().toFlowable(BackpressureStrategy.BUFFER));
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -201,9 +201,10 @@ public class HttpEntityArgumentResolverTests {
|
||||
ResolvableType type = httpEntityType(forClassWithGenerics(Flowable.class, String.class));
|
||||
HttpEntity<Flowable<String>> entity = resolveValueWithEmptyBody(type);
|
||||
|
||||
ScriptedSubscriber
|
||||
.create().expectNextCount(0)
|
||||
.expectComplete().verify(entity.getBody());
|
||||
Verifier.create(entity.getBody())
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -284,13 +285,12 @@ public class HttpEntityArgumentResolverTests {
|
||||
HttpEntity<Flux<String>> httpEntity = resolveValue(type, body);
|
||||
|
||||
assertEquals(this.request.getHeaders(), httpEntity.getHeaders());
|
||||
ScriptedSubscriber
|
||||
.<String>create()
|
||||
Verifier.create(httpEntity.getBody())
|
||||
.expectNext("line1\n")
|
||||
.expectNext("line2\n")
|
||||
.expectNext("line3\n")
|
||||
.expectComplete()
|
||||
.verify(httpEntity.getBody());
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
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);
|
||||
|
||||
ScriptedSubscriber.create().expectError(UnsupportedMediaTypeStatusException.class).verify(result);
|
||||
Verifier.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();
|
||||
|
||||
ScriptedSubscriber.create().expectError(ServerWebInputException.class).verify(result);
|
||||
Verifier.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);
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0).expectError(ServerWebInputException.class).verify(mono);
|
||||
Verifier.create(mono).expectNextCount(0).expectError(ServerWebInputException.class).verify();
|
||||
}
|
||||
|
||||
@Test @SuppressWarnings("unchecked")
|
||||
@@ -283,10 +283,10 @@ public class MessageReaderArgumentResolverTests {
|
||||
MethodParameter param = this.testMethod.resolveParam(type);
|
||||
Flux<TestBean> flux = resolveValue(param, body);
|
||||
|
||||
ScriptedSubscriber.<TestBean>create()
|
||||
Verifier.create(flux)
|
||||
.expectNext(new TestBean("f1", "b1"))
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(flux);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test // SPR-9964
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
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);
|
||||
|
||||
ScriptedSubscriber.create().expectError(IllegalStateException.class).verify(mono);
|
||||
Verifier.create(mono).expectError(IllegalStateException.class).verify();
|
||||
}
|
||||
|
||||
@Test // SPR-12811
|
||||
@@ -194,11 +194,11 @@ public class MessageWriterResultHandlerTests {
|
||||
}
|
||||
|
||||
private void assertResponseBody(String responseBody) {
|
||||
ScriptedSubscriber.<DataBuffer>create()
|
||||
Verifier.create(this.response.getBody())
|
||||
.consumeNextWith(buf -> assertEquals(responseBody,
|
||||
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
|
||||
.expectComplete()
|
||||
.verify(this.response.getBody());
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.annotation.SynthesizingMethodParameter;
|
||||
@@ -134,20 +134,21 @@ public class PathVariableMethodArgumentResolverTests {
|
||||
public void handleMissingValue() throws Exception {
|
||||
BindingContext bindingContext = new BindingContext();
|
||||
Mono<Object> mono = this.resolver.resolveArgument(this.paramNamedString, bindingContext, this.exchange);
|
||||
ScriptedSubscriber
|
||||
.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerErrorException.class)
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nullIfNotRequired() throws Exception {
|
||||
BindingContext bindingContext = new BindingContext();
|
||||
Mono<Object> mono = this.resolver.resolveArgument(this.paramNotRequired, bindingContext, this.exchange);
|
||||
ScriptedSubscriber
|
||||
.create().expectNextCount(0)
|
||||
Verifier
|
||||
.create(mono)
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -155,13 +156,13 @@ public class PathVariableMethodArgumentResolverTests {
|
||||
BindingContext bindingContext = new BindingContext();
|
||||
Mono<Object> mono = this.resolver.resolveArgument(this.paramOptional, bindingContext, this.exchange);
|
||||
|
||||
ScriptedSubscriber.create()
|
||||
Verifier.create(mono)
|
||||
.consumeNextWith(value -> {
|
||||
assertTrue(value instanceof Optional);
|
||||
assertFalse(((Optional) value).isPresent());
|
||||
})
|
||||
.expectComplete()
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.core.DefaultParameterNameDiscoverer;
|
||||
@@ -89,9 +89,10 @@ public class RequestAttributeMethodArgumentResolverTests {
|
||||
public void resolve() throws Exception {
|
||||
MethodParameter param = initMethodParameter(0);
|
||||
Mono<Object> mono = this.resolver.resolveArgument(param, new BindingContext(), this.exchange);
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(mono);
|
||||
.verify();
|
||||
|
||||
Foo foo = new Foo();
|
||||
this.exchange.getAttributes().put("foo", foo);
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
import rx.Observable;
|
||||
import rx.RxReactiveStreams;
|
||||
import rx.Single;
|
||||
@@ -126,13 +126,15 @@ public class RequestBodyArgumentResolverTests {
|
||||
public void emptyBodyWithMono() throws Exception {
|
||||
ResolvableType type = forClassWithGenerics(Mono.class, String.class);
|
||||
|
||||
ScriptedSubscriber.<Void>create().expectNextCount(0)
|
||||
Verifier.create((Mono<Void>) resolveValueWithEmptyBody(type, true))
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify((Mono<Void>) resolveValueWithEmptyBody(type, true));
|
||||
.verify();
|
||||
|
||||
ScriptedSubscriber.<Void>create().expectNextCount(0)
|
||||
Verifier.create((Mono<Void>) resolveValueWithEmptyBody(type, false))
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify((Mono<Void>) resolveValueWithEmptyBody(type, false));
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -140,13 +142,15 @@ public class RequestBodyArgumentResolverTests {
|
||||
public void emptyBodyWithFlux() throws Exception {
|
||||
ResolvableType type = forClassWithGenerics(Flux.class, String.class);
|
||||
|
||||
ScriptedSubscriber.<Void>create().expectNextCount(0)
|
||||
Verifier.create((Flux<Void>) resolveValueWithEmptyBody(type, true))
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify((Flux<Void>) resolveValueWithEmptyBody(type, true));
|
||||
.verify();
|
||||
|
||||
ScriptedSubscriber.<Void>create().expectNextCount(0)
|
||||
Verifier.create((Flux<Void>) resolveValueWithEmptyBody(type, false))
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify((Flux<Void>) resolveValueWithEmptyBody(type, false));
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -154,14 +158,16 @@ public class RequestBodyArgumentResolverTests {
|
||||
ResolvableType type = forClassWithGenerics(Single.class, String.class);
|
||||
|
||||
Single<String> single = resolveValueWithEmptyBody(type, true);
|
||||
ScriptedSubscriber.<String>create().expectNextCount(0)
|
||||
Verifier.create(RxReactiveStreams.toPublisher(single))
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(RxReactiveStreams.toPublisher(single));
|
||||
.verify();
|
||||
|
||||
single = resolveValueWithEmptyBody(type, false);
|
||||
ScriptedSubscriber.<String>create().expectNextCount(0)
|
||||
Verifier.create(RxReactiveStreams.toPublisher(single))
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(RxReactiveStreams.toPublisher(single));
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -169,14 +175,16 @@ public class RequestBodyArgumentResolverTests {
|
||||
ResolvableType type = forClassWithGenerics(Maybe.class, String.class);
|
||||
|
||||
Maybe<String> maybe = resolveValueWithEmptyBody(type, true);
|
||||
ScriptedSubscriber.<String>create().expectNextCount(0)
|
||||
Verifier.create(maybe.toFlowable())
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(maybe.toFlowable());
|
||||
.verify();
|
||||
|
||||
maybe = resolveValueWithEmptyBody(type, false);
|
||||
ScriptedSubscriber.<String>create().expectNextCount(0)
|
||||
Verifier.create(maybe.toFlowable())
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify(maybe.toFlowable());
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -184,14 +192,16 @@ public class RequestBodyArgumentResolverTests {
|
||||
ResolvableType type = forClassWithGenerics(Observable.class, String.class);
|
||||
|
||||
Observable<String> observable = resolveValueWithEmptyBody(type, true);
|
||||
ScriptedSubscriber.<String>create().expectNextCount(0)
|
||||
Verifier.create(RxReactiveStreams.toPublisher(observable))
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(RxReactiveStreams.toPublisher(observable));
|
||||
.verify();
|
||||
|
||||
observable = resolveValueWithEmptyBody(type, false);
|
||||
ScriptedSubscriber.<String>create().expectNextCount(0)
|
||||
Verifier.create(RxReactiveStreams.toPublisher(observable))
|
||||
.expectNextCount(0)
|
||||
.expectComplete()
|
||||
.verify(RxReactiveStreams.toPublisher(observable));
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.core.MethodParameter;
|
||||
@@ -203,9 +203,10 @@ public class RequestHeaderMethodArgumentResolverTests {
|
||||
Mono<Object> mono = resolver.resolveArgument(
|
||||
this.paramNamedValueStringArray, this.bindingContext, this.exchange);
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
|
||||
import org.springframework.core.MethodParameter;
|
||||
@@ -159,9 +159,10 @@ public class RequestParamMethodArgumentResolverTests {
|
||||
Mono<Object> mono = this.resolver.resolveArgument(
|
||||
this.paramNamedStringArray, this.bindingContext, this.exchange);
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.expectError(ServerWebInputException.class)
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
import rx.Completable;
|
||||
import rx.Single;
|
||||
|
||||
@@ -291,11 +291,11 @@ public class ResponseEntityResultHandlerTests {
|
||||
}
|
||||
|
||||
private void assertResponseBody(String responseBody) {
|
||||
ScriptedSubscriber.<DataBuffer>create()
|
||||
Verifier.create(this.response.getBody())
|
||||
.consumeNextWith(buf -> assertEquals(responseBody,
|
||||
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
|
||||
.expectComplete()
|
||||
.verify(this.response.getBody());
|
||||
.verify();
|
||||
}
|
||||
|
||||
private void assertConditionalResponse(HttpStatus status, String body, String etag, Instant lastModified) throws Exception {
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
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);
|
||||
ScriptedSubscriber.create().expectError(ServerWebInputException.class).verify(mono);
|
||||
Verifier.create(mono).expectError(ServerWebInputException.class).verify();
|
||||
|
||||
Foo foo = new Foo();
|
||||
when(this.session.getAttribute("foo")).thenReturn(Optional.of(foo));
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.reactive.ClientRequest;
|
||||
@@ -87,11 +87,11 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
.map(s -> (s.replace("\n", "")))
|
||||
.take(2);
|
||||
|
||||
ScriptedSubscriber.<String>create()
|
||||
Verifier.create(result)
|
||||
.expectNext("data:foo 0")
|
||||
.expectNext("data:foo 1")
|
||||
.expectComplete()
|
||||
.verify(result, Duration.ofSeconds(5L));
|
||||
.verify(Duration.ofSeconds(5L));
|
||||
}
|
||||
@Test
|
||||
public void sseAsPerson() throws Exception {
|
||||
@@ -109,10 +109,10 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
.takeUntil(s -> s.endsWith("foo 1\"}"))
|
||||
.reduce((s1, s2) -> s1 + s2);
|
||||
|
||||
ScriptedSubscriber.<String>create()
|
||||
Verifier.create(result)
|
||||
.expectNext("data:{\"name\":\"foo 0\"}data:{\"name\":\"foo 1\"}")
|
||||
.expectComplete()
|
||||
.verify(result, Duration.ofSeconds(5L));
|
||||
.verify(Duration.ofSeconds(5L));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -129,11 +129,11 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
.map(s -> s.replace("\n", ""))
|
||||
.take(2);
|
||||
|
||||
ScriptedSubscriber.<String>create()
|
||||
Verifier.create(result)
|
||||
.expectNext("id:0:bardata:foo")
|
||||
.expectNext("id:1:bardata:foo")
|
||||
.expectComplete()
|
||||
.verify(result, Duration.ofSeconds(5L));
|
||||
.verify(Duration.ofSeconds(5L));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -151,11 +151,11 @@ public class SseIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
.map(s -> s.replace("\n", ""))
|
||||
.take(2);
|
||||
|
||||
ScriptedSubscriber.<String>create()
|
||||
Verifier.create(result)
|
||||
.expectNext("id:0:bardata:foo")
|
||||
.expectNext("id:1:bardata:foo")
|
||||
.expectComplete()
|
||||
.verify(result, Duration.ofSeconds(5L));
|
||||
.verify(Duration.ofSeconds(5L));
|
||||
}
|
||||
|
||||
@RestController
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import reactor.test.subscriber.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.core.codec.CharSequenceEncoder;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
@@ -155,12 +155,12 @@ public class HttpMessageWriterViewTests {
|
||||
|
||||
this.view.render(this.model, MediaType.APPLICATION_JSON, exchange);
|
||||
|
||||
ScriptedSubscriber.<DataBuffer>create()
|
||||
Verifier.create(response.getBody())
|
||||
.consumeNextWith( buf -> assertEquals("{\"foo\":\"f\",\"bar\":\"b\"}",
|
||||
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8))
|
||||
)
|
||||
.expectComplete()
|
||||
.verify(response.getBody());
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
import rx.Completable;
|
||||
import rx.Single;
|
||||
|
||||
@@ -204,9 +204,10 @@ public class ViewResolutionResultHandlerTests {
|
||||
this.request.setUri("/path");
|
||||
Mono<Void> mono = createResultHandler().handleResult(this.exchange, handlerResult);
|
||||
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.expectErrorWith(err -> err.getMessage().equals("Could not resolve view with name 'account'."))
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -239,9 +240,10 @@ public class ViewResolutionResultHandlerTests {
|
||||
|
||||
ViewResolutionResultHandler resultHandler = createResultHandler(new TestViewResolver("account"));
|
||||
Mono<Void> mono = resultHandler.handleResult(this.exchange, handlerResult);
|
||||
ScriptedSubscriber.create().expectNextCount(0)
|
||||
Verifier.create(mono)
|
||||
.expectNextCount(0)
|
||||
.expectError(NotAcceptableStatusException.class)
|
||||
.verify(mono);
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
@@ -291,11 +293,11 @@ public class ViewResolutionResultHandlerTests {
|
||||
}
|
||||
|
||||
private void assertResponseBody(String responseBody) {
|
||||
ScriptedSubscriber.<DataBuffer>create()
|
||||
Verifier.create(this.response.getBody())
|
||||
.consumeNextWith(buf -> assertEquals(responseBody,
|
||||
DataBufferTestUtils.dumpString(buf, StandardCharsets.UTF_8)))
|
||||
.expectComplete()
|
||||
.verify(this.response.getBody());
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.ScriptedSubscriber;
|
||||
import reactor.test.subscriber.Verifier;
|
||||
|
||||
import org.springframework.context.ApplicationContextException;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
@@ -123,12 +123,12 @@ public class FreeMarkerViewTests {
|
||||
model.addAttribute("hello", "hi FreeMarker");
|
||||
view.render(model, null, this.exchange);
|
||||
|
||||
ScriptedSubscriber.<DataBuffer>create()
|
||||
Verifier.create(this.response.getBody())
|
||||
.consumeNextWith(buf -> {
|
||||
assertEquals("<html><body>hi FreeMarker</body></html>", asString(buf));
|
||||
})
|
||||
.expectComplete()
|
||||
.verify(this.response.getBody());
|
||||
.verify();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user