diff --git a/spring-web/src/test/java/org/springframework/web/filter/reactive/ServerWebExchangeContextFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/reactive/ServerWebExchangeContextFilterTests.java index 62c62b553d6..169f2efe480 100644 --- a/spring-web/src/test/java/org/springframework/web/filter/reactive/ServerWebExchangeContextFilterTests.java +++ b/spring-web/src/test/java/org/springframework/web/filter/reactive/ServerWebExchangeContextFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.web.filter.reactive; import java.time.Duration; @@ -33,10 +34,10 @@ import static org.assertj.core.api.Assertions.assertThat; * Unit tests for {@link ServerWebExchangeContextFilter}. * @author Rossen Stoyanchev */ -public class ServerWebExchangeContextFilterTests { +class ServerWebExchangeContextFilterTests { @Test - public void extractServerWebExchangeFromContext() { + void extractServerWebExchangeFromContext() { MyService service = new MyService(); HttpHandler httpHandler = WebHttpHandlerBuilder @@ -61,7 +62,7 @@ public class ServerWebExchangeContextFilterTests { } public Mono service() { - return Mono.just("result").subscriberContext(context -> { + return Mono.just("result").contextWrite(context -> { ServerWebExchangeContextFilter.get(context).ifPresent(exchangeRef::set); return context; }); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolverTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolverTests.java index 5be02293760..1fcba691ab6 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolverTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import java.time.Duration; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; import reactor.core.publisher.MonoProcessor; +import reactor.core.publisher.Sinks; import org.springframework.core.MethodParameter; import org.springframework.core.ReactiveAdapterRegistry; @@ -42,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException; * * @author Rossen Stoyanchev */ -public class ErrorsMethodArgumentResolverTests { +class ErrorsMethodArgumentResolverTests { private final ErrorsMethodArgumentResolver resolver = new ErrorsMethodArgumentResolver(ReactiveAdapterRegistry.getSharedInstance()); @@ -56,7 +57,7 @@ public class ErrorsMethodArgumentResolverTests { @Test - public void supports() { + void supports() { MethodParameter parameter = this.testMethod.arg(Errors.class); assertThat(this.resolver.supportsParameter(parameter)).isTrue(); @@ -71,7 +72,7 @@ public class ErrorsMethodArgumentResolverTests { } @Test - public void resolve() { + void resolve() { BindingResult bindingResult = createBindingResult(new Foo(), "foo"); this.bindingContext.getModel().asMap().put(BindingResult.MODEL_KEY_PREFIX + "foo", bindingResult); @@ -88,9 +89,9 @@ public class ErrorsMethodArgumentResolverTests { } @Test - public void resolveWithMono() { + void resolveWithMono() { BindingResult bindingResult = createBindingResult(new Foo(), "foo"); - MonoProcessor monoProcessor = MonoProcessor.create(); + MonoProcessor monoProcessor = MonoProcessor.fromSink(Sinks.one()); monoProcessor.onNext(bindingResult); this.bindingContext.getModel().asMap().put(BindingResult.MODEL_KEY_PREFIX + "foo", monoProcessor); @@ -102,7 +103,7 @@ public class ErrorsMethodArgumentResolverTests { } @Test - public void resolveWithMonoOnBindingResultAndModelAttribute() { + void resolveWithMonoOnBindingResultAndModelAttribute() { MethodParameter parameter = this.testMethod.arg(BindingResult.class); assertThatIllegalStateException().isThrownBy(() -> this.resolver.resolveArgument(parameter, this.bindingContext, this.exchange) @@ -112,7 +113,7 @@ public class ErrorsMethodArgumentResolverTests { } @Test // SPR-16187 - public void resolveWithBindingResultNotFound() { + void resolveWithBindingResultNotFound() { MethodParameter parameter = this.testMethod.arg(Errors.class); assertThatIllegalStateException().isThrownBy(() -> this.resolver.resolveArgument(parameter, this.bindingContext, this.exchange) diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandlerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandlerTests.java index 8b2a4f7fa95..dbd26329286 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandlerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/ReactiveTypeHandlerTests.java @@ -125,7 +125,7 @@ public class ReactiveTypeHandlerTests { @Test public void deferredResultSubscriberWithNoValues() throws Exception { - MonoProcessor monoEmpty = MonoProcessor.create(); + MonoProcessor monoEmpty = MonoProcessor.fromSink(Sinks.one()); testDeferredResultSubscriber(monoEmpty, Mono.class, forClass(String.class), monoEmpty::onComplete, null); } @@ -152,7 +152,7 @@ public class ReactiveTypeHandlerTests { IllegalStateException ex = new IllegalStateException(); // Mono - MonoProcessor mono = MonoProcessor.create(); + MonoProcessor mono = MonoProcessor.fromSink(Sinks.one()); testDeferredResultSubscriber(mono, Mono.class, forClass(String.class), () -> mono.onError(ex), ex); // RxJava Single