From 5c236e1edf2d5b7c347d44e5c6a886f33a6b3713 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 6 Jun 2016 10:12:02 -0400 Subject: [PATCH] Update to latest Reactor snapshot --- ...veStreamsToCompletableFutureConverter.java | 4 ++-- .../reactive/ChannelSendOperatorTests.java | 10 +++++----- .../reactive/ServerHttpResponseTests.java | 12 +++++------ .../reactive/DispatcherHandlerErrorTests.java | 6 +++--- .../ResponseStatusExceptionHandlerTests.java | 4 ++-- .../handler/SimpleUrlHandlerMappingTests.java | 2 +- .../method/HandlerMethodMappingTests.java | 8 ++++---- .../method/InvocableHandlerMethodTests.java | 6 +++--- ...RequestMappingInfoHandlerMappingTests.java | 4 ++-- ...equestAttributesArgumentResolverTests.java | 20 +++++++++---------- ...ookieValueMethodArgumentResolverTests.java | 6 +++--- ...ssionValueMethodArgumentResolverTests.java | 2 +- ...ariableMapMethodArgumentResolverTests.java | 4 ++-- ...thVariableMethodArgumentResolverTests.java | 2 +- ...tAttributeMethodArgumentResolverTests.java | 20 +++++++++---------- ...tHeaderMapMethodArgumentResolverTests.java | 6 +++--- ...uestHeaderMethodArgumentResolverTests.java | 16 +++++++-------- ...stParamMapMethodArgumentResolverTests.java | 4 ++-- ...questParamMethodArgumentResolverTests.java | 20 +++++++++---------- .../ResponseBodyResultHandlerTests.java | 8 +++----- ...nAttributeMethodArgumentResolverTests.java | 20 +++++++++---------- .../view/UrlBasedViewResolverTests.java | 4 ++-- .../ExceptionHandlingHttpHandlerTests.java | 8 ++++---- .../handler/FilteringWebHandlerTests.java | 15 ++++++-------- .../DefaultWebSessionManagerTests.java | 16 +++++++-------- 25 files changed, 111 insertions(+), 116 deletions(-) diff --git a/spring-web-reactive/src/main/java/org/springframework/core/convert/support/ReactiveStreamsToCompletableFutureConverter.java b/spring-web-reactive/src/main/java/org/springframework/core/convert/support/ReactiveStreamsToCompletableFutureConverter.java index 707b5c8078..41234dfe57 100644 --- a/spring-web-reactive/src/main/java/org/springframework/core/convert/support/ReactiveStreamsToCompletableFutureConverter.java +++ b/spring-web-reactive/src/main/java/org/springframework/core/convert/support/ReactiveStreamsToCompletableFutureConverter.java @@ -45,10 +45,10 @@ public class ReactiveStreamsToCompletableFutureConverter implements GenericConve return null; } else if (CompletableFuture.class.isAssignableFrom(source.getClass())) { - return Mono.fromCompletableFuture((CompletableFuture)source); + return Mono.fromFuture((CompletableFuture) source); } else if (CompletableFuture.class.isAssignableFrom(targetType.getResolvableType().getRawClass())) { - return Mono.from((Publisher)source).toCompletableFuture(); + return Mono.from((Publisher) source).toFuture(); } return null; } diff --git a/spring-web-reactive/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java b/spring-web-reactive/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java index 7db972ebd2..e6c056b7f8 100644 --- a/spring-web-reactive/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java @@ -57,7 +57,7 @@ public class ChannelSendOperatorTests { public void errorBeforeFirstItem() throws Exception { IllegalStateException error = new IllegalStateException("boo"); Mono completion = Mono.error(error).as(this::sendOperator); - Signal signal = completion.materialize().get(); + Signal signal = completion.materialize().block(); assertNotNull(signal); assertSame("Unexpected signal: " + signal, error, signal.getThrowable()); @@ -66,7 +66,7 @@ public class ChannelSendOperatorTests { @Test public void completionBeforeFirstItem() throws Exception { Mono completion = Flux.empty().as(this::sendOperator); - Signal signal = completion.materialize().get(); + Signal signal = completion.materialize().block(); assertNotNull(signal); assertTrue("Unexpected signal: " + signal, signal.isOnComplete()); @@ -78,7 +78,7 @@ public class ChannelSendOperatorTests { @Test public void writeOneItem() throws Exception { Mono completion = Flux.just("one").as(this::sendOperator); - Signal signal = completion.materialize().get(); + Signal signal = completion.materialize().block(); assertNotNull(signal); assertTrue("Unexpected signal: " + signal, signal.isOnComplete()); @@ -93,7 +93,7 @@ public class ChannelSendOperatorTests { public void writeMultipleItems() throws Exception { List items = Arrays.asList("one", "two", "three"); Mono completion = Flux.fromIterable(items).as(this::sendOperator); - Signal signal = completion.materialize().get(); + Signal signal = completion.materialize().block(); assertNotNull(signal); assertTrue("Unexpected signal: " + signal, signal.isOnComplete()); @@ -117,7 +117,7 @@ public class ChannelSendOperatorTests { return i; }); Mono completion = publisher.as(this::sendOperator); - Signal signal = completion.materialize().get(); + Signal signal = completion.materialize().block(); assertNotNull(signal); assertSame("Unexpected signal: " + signal, error, signal.getThrowable()); diff --git a/spring-web-reactive/src/test/java/org/springframework/http/server/reactive/ServerHttpResponseTests.java b/spring-web-reactive/src/test/java/org/springframework/http/server/reactive/ServerHttpResponseTests.java index e30181f73a..6eff9434bf 100644 --- a/spring-web-reactive/src/test/java/org/springframework/http/server/reactive/ServerHttpResponseTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/http/server/reactive/ServerHttpResponseTests.java @@ -45,7 +45,7 @@ public class ServerHttpResponseTests { @Test public void writeWith() throws Exception { TestServerHttpResponse response = new TestServerHttpResponse(); - response.writeWith(Flux.just(wrap("a"), wrap("b"), wrap("c"))).get(); + response.writeWith(Flux.just(wrap("a"), wrap("b"), wrap("c"))).block(); assertTrue(response.headersWritten); assertTrue(response.cookiesWritten); @@ -60,7 +60,7 @@ public class ServerHttpResponseTests { public void writeWithError() throws Exception { TestServerHttpResponse response = new TestServerHttpResponse(); IllegalStateException error = new IllegalStateException("boo"); - response.writeWith(Flux.error(error)).otherwise(ex -> Mono.empty()).get(); + response.writeWith(Flux.error(error)).otherwise(ex -> Mono.empty()).block(); assertFalse(response.headersWritten); assertFalse(response.cookiesWritten); @@ -70,7 +70,7 @@ public class ServerHttpResponseTests { @Test public void setComplete() throws Exception { TestServerHttpResponse response = new TestServerHttpResponse(); - response.setComplete().get(); + response.setComplete().block(); assertTrue(response.headersWritten); assertTrue(response.cookiesWritten); @@ -85,7 +85,7 @@ public class ServerHttpResponseTests { response.getCookies().add(cookie.getName(), cookie); return Mono.empty(); }); - response.writeWith(Flux.just(wrap("a"), wrap("b"), wrap("c"))).get(); + response.writeWith(Flux.just(wrap("a"), wrap("b"), wrap("c"))).block(); assertTrue(response.headersWritten); assertTrue(response.cookiesWritten); @@ -102,7 +102,7 @@ public class ServerHttpResponseTests { TestServerHttpResponse response = new TestServerHttpResponse(); IllegalStateException error = new IllegalStateException("boo"); response.beforeCommit(() -> Mono.error(error)); - response.writeWith(Flux.just(wrap("a"), wrap("b"), wrap("c"))).get(); + response.writeWith(Flux.just(wrap("a"), wrap("b"), wrap("c"))).block(); assertTrue("beforeCommit action errors should be ignored", response.headersWritten); assertTrue("beforeCommit action errors should be ignored", response.cookiesWritten); @@ -122,7 +122,7 @@ public class ServerHttpResponseTests { response.getCookies().add(cookie.getName(), cookie); return Mono.empty(); }); - response.setComplete().get(); + response.setComplete().block(); assertTrue(response.headersWritten); assertTrue(response.cookiesWritten); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/DispatcherHandlerErrorTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/DispatcherHandlerErrorTests.java index bbea4c62d1..8a28d1ce30 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/DispatcherHandlerErrorTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/DispatcherHandlerErrorTests.java @@ -191,7 +191,7 @@ public class DispatcherHandlerErrorTests { WebHandler webHandler = new ExceptionHandlingWebHandler(this.dispatcherHandler, exceptionHandler); Mono publisher = webHandler.handle(this.exchange); - publisher.get(); + publisher.block(); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, this.response.getStatus()); } @@ -203,13 +203,13 @@ public class DispatcherHandlerErrorTests { webHandler = new ExceptionHandlingWebHandler(webHandler, new ServerError500ExceptionHandler()); Mono publisher = webHandler.handle(this.exchange); - publisher.get(); + publisher.block(); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, this.response.getStatus()); } private Throwable awaitErrorSignal(Mono mono) throws Exception { - Signal signal = mono.materialize().get(); + Signal signal = mono.materialize().block(); assertEquals("Unexpected signal: " + signal, SignalKind.onError, signal.getType()); return signal.getThrowable(); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/ResponseStatusExceptionHandlerTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/ResponseStatusExceptionHandlerTests.java index f36b67f2bb..5929587ec9 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/ResponseStatusExceptionHandlerTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/ResponseStatusExceptionHandlerTests.java @@ -63,7 +63,7 @@ public class ResponseStatusExceptionHandlerTests { Throwable ex = new ResponseStatusException(HttpStatus.BAD_REQUEST, ""); Mono publisher = this.handler.handle(this.exchange, ex); - publisher.get(); + publisher.block(); assertEquals(HttpStatus.BAD_REQUEST, this.response.getStatus()); } @@ -72,7 +72,7 @@ public class ResponseStatusExceptionHandlerTests { Throwable ex = new IllegalStateException(); Mono publisher = this.handler.handle(this.exchange, ex); - Signal signal = publisher.materialize().get(); + Signal signal = publisher.materialize().block(); assertNotNull(signal); assertTrue(signal.hasError()); assertSame(ex, signal.getThrowable()); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/handler/SimpleUrlHandlerMappingTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/handler/SimpleUrlHandlerMappingTests.java index eccda562f6..599fcc3b03 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/handler/SimpleUrlHandlerMappingTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/handler/SimpleUrlHandlerMappingTests.java @@ -108,7 +108,7 @@ public class SimpleUrlHandlerMappingTests { throws URISyntaxException { ServerWebExchange exchange = createExchange(url); - Object actual = handlerMapping.getHandler(exchange).get(); + Object actual = handlerMapping.getHandler(exchange).block(); if (bean != null) { assertNotNull(actual); assertSame(bean, actual); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/HandlerMethodMappingTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/HandlerMethodMappingTests.java index 87b005f2a9..15df98eb97 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/HandlerMethodMappingTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/HandlerMethodMappingTests.java @@ -84,7 +84,7 @@ public class HandlerMethodMappingTests { this.mapping.registerMapping(key, this.handler, this.method1); Mono result = this.mapping.getHandler(createExchange(HttpMethod.GET, key)); - assertEquals(this.method1, ((HandlerMethod) result.get()).getMethod()); + assertEquals(this.method1, ((HandlerMethod) result.block()).getMethod()); } @Test @@ -93,7 +93,7 @@ public class HandlerMethodMappingTests { this.mapping.registerMapping("/f*", this.handler, this.method2); Mono result = this.mapping.getHandler(createExchange(HttpMethod.GET, "/foo")); - assertEquals(this.method1, ((HandlerMethod) result.get()).getMethod()); + assertEquals(this.method1, ((HandlerMethod) result.block()).getMethod()); } @Test @@ -140,11 +140,11 @@ public class HandlerMethodMappingTests { String key = "foo"; this.mapping.registerMapping(key, this.handler, this.method1); Mono result = this.mapping.getHandler(createExchange(HttpMethod.GET, key)); - assertNotNull(result.get()); + assertNotNull(result.block()); this.mapping.unregisterMapping(key); result = this.mapping.getHandler(createExchange(HttpMethod.GET, key)); - assertNull(result.get()); + assertNull(result.block()); assertNull(this.mapping.getMappingRegistry().getMappingsByUrl(key)); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java index 44a5302c36..1e8df0b71e 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/InvocableHandlerMethodTests.java @@ -90,7 +90,7 @@ public class InvocableHandlerMethodTests { new RequestParamMethodArgumentResolver(new GenericConversionService(), null, false))); Mono mono = hm.invokeForRequest(this.exchange, this.model); - HandlerResult value = mono.get(); + HandlerResult value = mono.block(); assertNotNull(value); assertEquals("success:null", value.getReturnValue().get()); @@ -102,7 +102,7 @@ public class InvocableHandlerMethodTests { addResolver(hm, Mono.just("value1")); Mono mono = hm.invokeForRequest(this.exchange, this.model); - HandlerResult value = mono.get(); + HandlerResult value = mono.block(); assertNotNull(value); assertEquals("success:value1", value.getReturnValue().get()); @@ -114,7 +114,7 @@ public class InvocableHandlerMethodTests { addResolver(hm, Flux.fromIterable(Arrays.asList("value1", "value2", "value3"))); Mono mono = hm.invokeForRequest(this.exchange, this.model); - HandlerResult value = mono.get(); + HandlerResult value = mono.block(); assertNotNull(value); assertEquals("success:value1", value.getReturnValue().get()); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java index 31f4c3b00c..1fe69c50fb 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/RequestMappingInfoHandlerMappingTests.java @@ -368,7 +368,7 @@ public class RequestMappingInfoHandlerMappingTests { @SuppressWarnings("ConstantConditions") private HandlerMethod getHandler(ServerWebExchange exchange) throws Exception { Mono handler = this.handlerMapping.getHandler(exchange); - return (HandlerMethod) handler.get(); + return (HandlerMethod) handler.block(); } private void testHttpMediaTypeNotSupportedException(String url) throws Exception { @@ -389,7 +389,7 @@ public class RequestMappingInfoHandlerMappingTests { ModelMap model = new ExtendedModelMap(); Mono mono = new InvocableHandlerMethod(handlerMethod).invokeForRequest(exchange, model); - HandlerResult result = mono.get(); + HandlerResult result = mono.block(); assertNotNull(result); Optional value = result.getReturnValue(); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/AbstractRequestAttributesArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/AbstractRequestAttributesArgumentResolverTests.java index 6e12aea212..c84db1c111 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/AbstractRequestAttributesArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/AbstractRequestAttributesArgumentResolverTests.java @@ -103,7 +103,7 @@ public abstract class AbstractRequestAttributesArgumentResolverTests { Foo foo = new Foo(); this.exchange.getAttributes().put("foo", foo); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test @@ -112,36 +112,36 @@ public abstract class AbstractRequestAttributesArgumentResolverTests { Foo foo = new Foo(); this.exchange.getAttributes().put("specialFoo", foo); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test public void resolveNotRequired() throws Exception { MethodParameter param = initMethodParameter(2); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNull(mono.get()); + assertNull(mono.block()); Foo foo = new Foo(); this.exchange.getAttributes().put("foo", foo); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test public void resolveOptional() throws Exception { MethodParameter param = initMethodParameter(3); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNotNull(mono.get()); - assertEquals(Optional.class, mono.get().getClass()); - assertFalse(((Optional) mono.get()).isPresent()); + assertNotNull(mono.block()); + assertEquals(Optional.class, mono.block().getClass()); + assertFalse(((Optional) mono.block()).isPresent()); Foo foo = new Foo(); this.exchange.getAttributes().put("foo", foo); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNotNull(mono.get()); - assertEquals(Optional.class, mono.get().getClass()); - Optional optional = (Optional) mono.get(); + assertNotNull(mono.block()); + assertEquals(Optional.class, mono.block().getClass()); + Optional optional = (Optional) mono.block(); assertTrue(optional.isPresent()); assertSame(foo, optional.get()); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java index 4951337b20..de710dada9 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/CookieValueMethodArgumentResolverTests.java @@ -92,7 +92,7 @@ public class CookieValueMethodArgumentResolverTests { this.exchange.getRequest().getCookies().add(expected.getName(), expected); Mono mono = this.resolver.resolveArgument(this.cookieParameter, null, this.exchange); - assertEquals(expected, mono.get()); + assertEquals(expected, mono.block()); } @Test @@ -101,13 +101,13 @@ public class CookieValueMethodArgumentResolverTests { this.exchange.getRequest().getCookies().add(cookie.getName(), cookie); Mono mono = this.resolver.resolveArgument(this.cookieStringParameter, null, this.exchange); - assertEquals("Invalid result", cookie.getValue(), mono.get()); + assertEquals("Invalid result", cookie.getValue(), mono.block()); } @Test public void resolveCookieDefaultValue() { Mono mono = this.resolver.resolveArgument(this.cookieStringParameter, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals("bar", result); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java index 52ae4a2a11..f31d996962 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ExpressionValueMethodArgumentResolverTests.java @@ -84,7 +84,7 @@ public class ExpressionValueMethodArgumentResolverTests { System.setProperty("systemProperty", "22"); try { Mono mono = this.resolver.resolveArgument(this.paramSystemProperty, null, this.exchange); - Object value = mono.get(); + Object value = mono.block(); assertEquals(22, value); } finally { diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java index 851e77e804..bdbf50e541 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMapMethodArgumentResolverTests.java @@ -88,7 +88,7 @@ public class PathVariableMapMethodArgumentResolverTests { this.exchange.getAttributes().put(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars); Mono mono = this.resolver.resolveArgument(this.paramMap, new ModelMap(), this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertEquals(uriTemplateVars, result); } @@ -96,7 +96,7 @@ public class PathVariableMapMethodArgumentResolverTests { @Test public void resolveArgumentNoUriVars() throws Exception { Mono mono = this.resolver.resolveArgument(this.paramMap, new ModelMap(), this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertEquals(Collections.emptyMap(), result); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java index 065c624903..0f4dacb00f 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/PathVariableMethodArgumentResolverTests.java @@ -89,7 +89,7 @@ public class PathVariableMethodArgumentResolverTests { this.exchange.getAttributes().put(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, uriTemplateVars); Mono mono = this.resolver.resolveArgument(this.paramNamedString, new ModelMap(), this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals("value", result); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java index 000e695cbb..19c7c2e64e 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestAttributeMethodArgumentResolverTests.java @@ -97,7 +97,7 @@ public class RequestAttributeMethodArgumentResolverTests { Foo foo = new Foo(); this.exchange.getAttributes().put("foo", foo); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test @@ -106,36 +106,36 @@ public class RequestAttributeMethodArgumentResolverTests { Foo foo = new Foo(); this.exchange.getAttributes().put("specialFoo", foo); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test public void resolveNotRequired() throws Exception { MethodParameter param = initMethodParameter(2); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNull(mono.get()); + assertNull(mono.block()); Foo foo = new Foo(); this.exchange.getAttributes().put("foo", foo); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test public void resolveOptional() throws Exception { MethodParameter param = initMethodParameter(3); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNotNull(mono.get()); - assertEquals(Optional.class, mono.get().getClass()); - assertFalse(((Optional) mono.get()).isPresent()); + assertNotNull(mono.block()); + assertEquals(Optional.class, mono.block().getClass()); + assertFalse(((Optional) mono.block()).isPresent()); Foo foo = new Foo(); this.exchange.getAttributes().put("foo", foo); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNotNull(mono.get()); - assertEquals(Optional.class, mono.get().getClass()); - Optional optional = (Optional) mono.get(); + assertNotNull(mono.block()); + assertEquals(Optional.class, mono.block().getClass()); + Optional optional = (Optional) mono.block(); assertTrue(optional.isPresent()); assertSame(foo, optional.get()); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolverTests.java index a2e48579af..50ac008eb9 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMapMethodArgumentResolverTests.java @@ -93,7 +93,7 @@ public class RequestHeaderMapMethodArgumentResolverTests { this.exchange.getRequest().getHeaders().add(name, value); Mono mono = this.resolver.resolveArgument(paramMap, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof Map); assertEquals("Invalid result", expected, result); @@ -113,7 +113,7 @@ public class RequestHeaderMapMethodArgumentResolverTests { expected.add(name, value2); Mono mono = this.resolver.resolveArgument(paramMultiValueMap, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof MultiValueMap); assertEquals("Invalid result", expected, result); @@ -133,7 +133,7 @@ public class RequestHeaderMapMethodArgumentResolverTests { expected.add(name, value2); Mono mono = this.resolver.resolveArgument(paramHttpHeaders, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof HttpHeaders); assertEquals("Invalid result", expected, result); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java index 5b22d56eb5..c2d76f5fa4 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestHeaderMethodArgumentResolverTests.java @@ -109,7 +109,7 @@ public class RequestHeaderMethodArgumentResolverTests { this.exchange.getRequest().getHeaders().add("name", expected); Mono mono = this.resolver.resolveArgument(paramNamedDefaultValueStringHeader, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals(expected, result); } @@ -120,7 +120,7 @@ public class RequestHeaderMethodArgumentResolverTests { this.exchange.getRequest().getHeaders().put("name", Arrays.asList(expected)); Mono mono = this.resolver.resolveArgument(paramNamedValueStringArray, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String[]); assertArrayEquals(expected, (String[]) result); } @@ -128,7 +128,7 @@ public class RequestHeaderMethodArgumentResolverTests { @Test public void resolveDefaultValue() throws Exception { Mono mono = this.resolver.resolveArgument(paramNamedDefaultValueStringHeader, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals("bar", result); } @@ -138,7 +138,7 @@ public class RequestHeaderMethodArgumentResolverTests { System.setProperty("systemProperty", "bar"); try { Mono mono = this.resolver.resolveArgument(paramSystemProperty, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals("bar", result); } @@ -155,7 +155,7 @@ public class RequestHeaderMethodArgumentResolverTests { System.setProperty("systemProperty", "bar"); try { Mono mono = this.resolver.resolveArgument(paramResolvedNameWithExpression, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals(expected, result); } @@ -172,7 +172,7 @@ public class RequestHeaderMethodArgumentResolverTests { System.setProperty("systemProperty", "bar"); try { Mono mono = this.resolver.resolveArgument(paramResolvedNameWithPlaceholder, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals(expected, result); } @@ -196,7 +196,7 @@ public class RequestHeaderMethodArgumentResolverTests { this.exchange.getRequest().getHeaders().add("name", rfc1123val); Mono mono = this.resolver.resolveArgument(paramDate, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof Date); assertEquals(new Date(rfc1123val), result); @@ -208,7 +208,7 @@ public class RequestHeaderMethodArgumentResolverTests { this.exchange.getRequest().getHeaders().add("name", rfc1123val); Mono mono = this.resolver.resolveArgument(paramInstant, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof Instant); assertEquals(Instant.from(DateTimeFormatter.RFC_1123_DATE_TIME.parse(rfc1123val)), result); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolverTests.java index c33daa06ef..a8ba097182 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMapMethodArgumentResolverTests.java @@ -94,7 +94,7 @@ public class RequestParamMapMethodArgumentResolverTests { Map expected = Collections.singletonMap(name, value); Mono mono = resolver.resolveArgument(paramMap, null, exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof Map); assertEquals(expected, result); @@ -112,7 +112,7 @@ public class RequestParamMapMethodArgumentResolverTests { expected.add(name, value2); Mono mono = this.resolver.resolveArgument(this.paramMultiValueMap, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof MultiValueMap); assertEquals(expected, result); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java index b407348403..26b4ea8e5c 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestParamMethodArgumentResolverTests.java @@ -119,7 +119,7 @@ public class RequestParamMethodArgumentResolverTests { this.exchange.getRequest().getQueryParams().set("name", expected); Mono mono = this.resolver.resolveArgument(this.paramNamedDefaultValueString, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals("Invalid result", expected, result); @@ -131,7 +131,7 @@ public class RequestParamMethodArgumentResolverTests { this.exchange.getRequest().getQueryParams().put("name", Arrays.asList(expected)); Mono mono = this.resolver.resolveArgument(this.paramNamedStringArray, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String[]); assertArrayEquals(expected, (String[]) result); @@ -140,7 +140,7 @@ public class RequestParamMethodArgumentResolverTests { @Test public void resolveDefaultValue() throws Exception { Mono mono = this.resolver.resolveArgument(paramNamedDefaultValueString, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals("Invalid result", "bar", result); @@ -158,7 +158,7 @@ public class RequestParamMethodArgumentResolverTests { public void resolveSimpleTypeParam() throws Exception { this.exchange.getRequest().getQueryParams().set("stringNotAnnot", "plainValue"); Mono mono = this.resolver.resolveArgument(paramStringNotAnnot, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertTrue(result instanceof String); assertEquals("plainValue", result); @@ -167,7 +167,7 @@ public class RequestParamMethodArgumentResolverTests { @Test // SPR-8561 public void resolveSimpleTypeParamToNull() throws Exception { Mono mono = this.resolver.resolveArgument(paramStringNotAnnot, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertNull(result); } @@ -176,7 +176,7 @@ public class RequestParamMethodArgumentResolverTests { public void resolveEmptyValueToDefault() throws Exception { this.exchange.getRequest().getQueryParams().set("name", ""); Mono mono = this.resolver.resolveArgument(paramNamedDefaultValueString, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertEquals("bar", result); } @@ -185,7 +185,7 @@ public class RequestParamMethodArgumentResolverTests { public void resolveEmptyValueWithoutDefault() throws Exception { this.exchange.getRequest().getQueryParams().set("stringNotAnnot", ""); Mono mono = this.resolver.resolveArgument(paramStringNotAnnot, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertEquals("", result); } @@ -194,7 +194,7 @@ public class RequestParamMethodArgumentResolverTests { public void resolveEmptyValueRequiredWithoutDefault() throws Exception { this.exchange.getRequest().getQueryParams().set("name", ""); Mono mono = this.resolver.resolveArgument(paramRequired, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertEquals("", result); } @@ -202,13 +202,13 @@ public class RequestParamMethodArgumentResolverTests { @Test public void resolveOptionalParamValue() throws Exception { Mono mono = this.resolver.resolveArgument(paramOptional, null, this.exchange); - Object result = mono.get(); + Object result = mono.block(); assertEquals(Optional.empty(), result); this.exchange.getRequest().getQueryParams().set("name", "123"); mono = resolver.resolveArgument(paramOptional, null, this.exchange); - result = mono.get(); + result = mono.block(); assertEquals(Optional.class, result.getClass()); Optional value = (Optional) result; diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseBodyResultHandlerTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseBodyResultHandlerTests.java index 15043cb1f8..de06a67488 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseBodyResultHandlerTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseBodyResultHandlerTests.java @@ -24,8 +24,6 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import javax.print.attribute.standard.Media; - import org.junit.Test; import org.reactivestreams.Publisher; @@ -47,9 +45,9 @@ import org.springframework.web.method.HandlerMethod; import org.springframework.web.reactive.HandlerMapping; import org.springframework.web.reactive.HandlerResult; import org.springframework.web.reactive.HandlerResultHandler; -import org.springframework.web.reactive.accept.RequestedContentTypeResolver; import org.springframework.web.reactive.accept.FixedContentTypeResolver; import org.springframework.web.reactive.accept.HeaderContentTypeResolver; +import org.springframework.web.reactive.accept.RequestedContentTypeResolver; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.DefaultServerWebExchange; import org.springframework.web.server.session.WebSessionManager; @@ -100,7 +98,7 @@ public class ResponseBodyResultHandlerTests { ServerWebExchange exchange = createExchange("/foo"); HandlerResult result = new HandlerResult(new Object(), "fooValue", ResolvableType.forClass(String.class)); - handler.handleResult(exchange, result).get(); + handler.handleResult(exchange, result).block(); assertEquals(contentType, exchange.getResponse().getHeaders().getContentType()); } @@ -114,7 +112,7 @@ public class ResponseBodyResultHandlerTests { HandlerResultHandler handler = createHandler(new StringEncoder(), new JacksonJsonEncoder()); HandlerResult result = new HandlerResult(new Object(), "fooValue", ResolvableType.forClass(String.class)); - handler.handleResult(exchange, result).get(); + handler.handleResult(exchange, result).block(); assertEquals(MediaType.APPLICATION_JSON, exchange.getResponse().getHeaders().getContentType()); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java index a85187a085..4eb0cab9d5 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java @@ -104,7 +104,7 @@ public class SessionAttributeMethodArgumentResolverTests { Foo foo = new Foo(); when(this.session.getAttribute("foo")).thenReturn(Optional.of(foo)); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test @@ -113,36 +113,36 @@ public class SessionAttributeMethodArgumentResolverTests { Foo foo = new Foo(); when(this.session.getAttribute("specialFoo")).thenReturn(Optional.of(foo)); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test public void resolveNotRequired() throws Exception { MethodParameter param = initMethodParameter(2); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNull(mono.get()); + assertNull(mono.block()); Foo foo = new Foo(); when(this.session.getAttribute("foo")).thenReturn(Optional.of(foo)); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertSame(foo, mono.get()); + assertSame(foo, mono.block()); } @Test public void resolveOptional() throws Exception { MethodParameter param = initMethodParameter(3); Mono mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNotNull(mono.get()); - assertEquals(Optional.class, mono.get().getClass()); - assertFalse(((Optional) mono.get()).isPresent()); + assertNotNull(mono.block()); + assertEquals(Optional.class, mono.block().getClass()); + assertFalse(((Optional) mono.block()).isPresent()); Foo foo = new Foo(); when(this.session.getAttribute("foo")).thenReturn(Optional.of(foo)); mono = this.resolver.resolveArgument(param, null, this.exchange); - assertNotNull(mono.get()); - assertEquals(Optional.class, mono.get().getClass()); - Optional optional = (Optional) mono.get(); + assertNotNull(mono.block()); + assertEquals(Optional.class, mono.block().getClass()); + Optional optional = (Optional) mono.block(); assertTrue(optional.isPresent()); assertSame(foo, optional.get()); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/UrlBasedViewResolverTests.java b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/UrlBasedViewResolverTests.java index d521a6e7ef..98d16dc17a 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/UrlBasedViewResolverTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/reactive/result/view/UrlBasedViewResolverTests.java @@ -48,10 +48,10 @@ public class UrlBasedViewResolverTests { resolver.setApplicationContext(context); Mono mono = resolver.resolveViewName("my-view", Locale.US); - assertNotNull(mono.get()); + assertNotNull(mono.block()); mono = resolver.resolveViewName("not-my-view", Locale.US); - assertNull(mono.get()); + assertNull(mono.block()); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/server/handler/ExceptionHandlingHttpHandlerTests.java b/spring-web-reactive/src/test/java/org/springframework/web/server/handler/ExceptionHandlingHttpHandlerTests.java index 0e1c0240bd..214fc0cf42 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/server/handler/ExceptionHandlingHttpHandlerTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/server/handler/ExceptionHandlingHttpHandlerTests.java @@ -62,7 +62,7 @@ public class ExceptionHandlingHttpHandlerTests { @Test public void handleErrorSignal() throws Exception { WebExceptionHandler exceptionHandler = new BadRequestExceptionHandler(); - createWebHandler(exceptionHandler).handle(this.exchange).get(); + createWebHandler(exceptionHandler).handle(this.exchange).block(); assertEquals(HttpStatus.BAD_REQUEST, this.response.getStatus()); } @@ -75,7 +75,7 @@ public class ExceptionHandlingHttpHandlerTests { new BadRequestExceptionHandler(), new UnresolvedExceptionHandler() }; - createWebHandler(exceptionHandlers).handle(this.exchange).get(); + createWebHandler(exceptionHandlers).handle(this.exchange).block(); assertEquals(HttpStatus.BAD_REQUEST, this.response.getStatus()); } @@ -83,7 +83,7 @@ public class ExceptionHandlingHttpHandlerTests { @Test public void unresolvedException() throws Exception { WebExceptionHandler exceptionHandler = new UnresolvedExceptionHandler(); - createWebHandler(exceptionHandler).handle(this.exchange).get(); + createWebHandler(exceptionHandler).handle(this.exchange).block(); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, this.response.getStatus()); } @@ -91,7 +91,7 @@ public class ExceptionHandlingHttpHandlerTests { @Test public void thrownExceptionBecomesErrorSignal() throws Exception { WebExceptionHandler exceptionHandler = new BadRequestExceptionHandler(); - createWebHandler(exceptionHandler).handle(this.exchange).get(); + createWebHandler(exceptionHandler).handle(this.exchange).block(); assertEquals(HttpStatus.BAD_REQUEST, this.response.getStatus()); } diff --git a/spring-web-reactive/src/test/java/org/springframework/web/server/handler/FilteringWebHandlerTests.java b/spring-web-reactive/src/test/java/org/springframework/web/server/handler/FilteringWebHandlerTests.java index 57078bbe02..206c03e8b2 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/server/handler/FilteringWebHandlerTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/server/handler/FilteringWebHandlerTests.java @@ -23,20 +23,17 @@ import org.apache.commons.logging.LogFactory; import org.junit.Before; import org.junit.Test; import reactor.core.publisher.Mono; -import reactor.core.test.TestSubscriber; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.server.reactive.HttpHandler; import org.springframework.http.server.reactive.MockServerHttpRequest; import org.springframework.http.server.reactive.MockServerHttpResponse; -import org.springframework.http.server.reactive.ServerHttpRequest; -import org.springframework.http.server.reactive.ServerHttpResponse; +import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebExceptionHandler; import org.springframework.web.server.WebFilter; import org.springframework.web.server.WebFilterChain; import org.springframework.web.server.WebHandler; -import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.adapter.WebHttpHandlerBuilder; import static org.junit.Assert.assertEquals; @@ -70,7 +67,7 @@ public class FilteringWebHandlerTests { TestFilter filter2 = new TestFilter(); TestFilter filter3 = new TestFilter(); HttpHandler httpHandler = createHttpHandler(webHandler, filter1, filter2, filter3); - httpHandler.handle(this.request, this.response).get(); + httpHandler.handle(this.request, this.response).block(); assertTrue(filter1.invoked()); assertTrue(filter2.invoked()); @@ -82,7 +79,7 @@ public class FilteringWebHandlerTests { public void zeroFilters() throws Exception { StubWebHandler webHandler = new StubWebHandler(); HttpHandler httpHandler = createHttpHandler(webHandler); - httpHandler.handle(this.request, this.response).get(); + httpHandler.handle(this.request, this.response).block(); assertTrue(webHandler.invoked()); } @@ -94,7 +91,7 @@ public class FilteringWebHandlerTests { ShortcircuitingFilter filter2 = new ShortcircuitingFilter(); TestFilter filter3 = new TestFilter(); HttpHandler httpHandler = createHttpHandler(webHandler, filter1, filter2, filter3); - httpHandler.handle(this.request, this.response).get(); + httpHandler.handle(this.request, this.response).block(); assertTrue(filter1.invoked()); assertTrue(filter2.invoked()); @@ -107,7 +104,7 @@ public class FilteringWebHandlerTests { StubWebHandler webHandler = new StubWebHandler(); AsyncFilter filter = new AsyncFilter(); HttpHandler httpHandler = createHttpHandler(webHandler, filter); - httpHandler.handle(this.request, this.response).get(); + httpHandler.handle(this.request, this.response).block(); assertTrue(filter.invoked()); assertTrue(webHandler.invoked()); @@ -118,7 +115,7 @@ public class FilteringWebHandlerTests { TestExceptionHandler exceptionHandler = new TestExceptionHandler(); HttpHandler handler = WebHttpHandlerBuilder.webHandler(new StubWebHandler()) .filters(new ExceptionFilter()).exceptionHandlers(exceptionHandler).build(); - handler.handle(this.request, this.response).get(); + handler.handle(this.request, this.response).block(); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, this.response.getStatus()); diff --git a/spring-web-reactive/src/test/java/org/springframework/web/server/session/DefaultWebSessionManagerTests.java b/spring-web-reactive/src/test/java/org/springframework/web/server/session/DefaultWebSessionManagerTests.java index 13efe415b6..297510b6cd 100644 --- a/spring-web-reactive/src/test/java/org/springframework/web/server/session/DefaultWebSessionManagerTests.java +++ b/spring-web-reactive/src/test/java/org/springframework/web/server/session/DefaultWebSessionManagerTests.java @@ -66,32 +66,32 @@ public class DefaultWebSessionManagerTests { @Test public void getSessionWithoutStarting() throws Exception { this.idResolver.setIdsToResolve(Collections.emptyList()); - WebSession session = this.manager.getSession(this.exchange).get(); + WebSession session = this.manager.getSession(this.exchange).block(); session.save(); assertFalse(session.isStarted()); assertFalse(session.isExpired()); assertNull(this.idResolver.getSavedId()); - assertNull(this.manager.getSessionStore().retrieveSession(session.getId()).get()); + assertNull(this.manager.getSessionStore().retrieveSession(session.getId()).block()); } @Test public void startSessionExplicitly() throws Exception { this.idResolver.setIdsToResolve(Collections.emptyList()); - WebSession session = this.manager.getSession(this.exchange).get(); + WebSession session = this.manager.getSession(this.exchange).block(); session.start(); session.save(); String id = session.getId(); assertNotNull(this.idResolver.getSavedId()); assertEquals(id, this.idResolver.getSavedId()); - assertSame(session, this.manager.getSessionStore().retrieveSession(id).get()); + assertSame(session, this.manager.getSessionStore().retrieveSession(id).block()); } @Test public void startSessionImplicitly() throws Exception { this.idResolver.setIdsToResolve(Collections.emptyList()); - WebSession session = this.manager.getSession(this.exchange).get(); + WebSession session = this.manager.getSession(this.exchange).block(); session.getAttributes().put("foo", "bar"); session.save(); @@ -104,7 +104,7 @@ public class DefaultWebSessionManagerTests { this.manager.getSessionStore().storeSession(existing); this.idResolver.setIdsToResolve(Collections.singletonList("1")); - WebSession actual = this.manager.getSession(this.exchange).get(); + WebSession actual = this.manager.getSession(this.exchange).block(); assertSame(existing, actual); } @@ -117,7 +117,7 @@ public class DefaultWebSessionManagerTests { this.manager.getSessionStore().storeSession(existing); this.idResolver.setIdsToResolve(Collections.singletonList("1")); - WebSession actual = this.manager.getSession(this.exchange).get(); + WebSession actual = this.manager.getSession(this.exchange).block(); assertNotSame(existing, actual); } @@ -127,7 +127,7 @@ public class DefaultWebSessionManagerTests { this.manager.getSessionStore().storeSession(existing); this.idResolver.setIdsToResolve(Arrays.asList("1", "2", "3")); - WebSession actual = this.manager.getSession(this.exchange).get(); + WebSession actual = this.manager.getSession(this.exchange).block(); assertSame(existing, actual); }