From d32cb7dac39c31922b9ce69dc0983f7d06b90207 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 7 Aug 2019 14:23:15 +0200 Subject: [PATCH] Avoid use of GenericTypeResolver.resolveParameterType() in tests This commit avoids the use of the deprecated GenericTypeResolver.resolveParameterType() method in tests in order to avoid warnings in the Gradle build. --- .../SessionAttributeMethodArgumentResolverTests.java | 4 +--- .../AbstractRequestAttributesArgumentResolverTests.java | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java index 35aa709104c..cb22574817c 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/SessionAttributeMethodArgumentResolverTests.java @@ -26,7 +26,6 @@ import reactor.test.StepVerifier; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.core.DefaultParameterNameDiscoverer; -import org.springframework.core.GenericTypeResolver; import org.springframework.core.MethodParameter; import org.springframework.core.ReactiveAdapterRegistry; import org.springframework.core.annotation.SynthesizingMethodParameter; @@ -139,8 +138,7 @@ public class SessionAttributeMethodArgumentResolverTests { private MethodParameter initMethodParameter(int parameterIndex) { MethodParameter param = new SynthesizingMethodParameter(this.handleMethod, parameterIndex); param.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); - GenericTypeResolver.resolveParameterType(param, this.resolver.getClass()); - return param; + return param.withContainingClass(this.resolver.getClass()); } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractRequestAttributesArgumentResolverTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractRequestAttributesArgumentResolverTests.java index e74fb5a2b45..355bc27cb2b 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractRequestAttributesArgumentResolverTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/AbstractRequestAttributesArgumentResolverTests.java @@ -25,7 +25,6 @@ import org.junit.Before; import org.junit.Test; import org.springframework.core.DefaultParameterNameDiscoverer; -import org.springframework.core.GenericTypeResolver; import org.springframework.core.MethodParameter; import org.springframework.core.annotation.SynthesizingMethodParameter; import org.springframework.core.convert.support.DefaultConversionService; @@ -153,8 +152,7 @@ public abstract class AbstractRequestAttributesArgumentResolverTests { private MethodParameter initMethodParameter(int parameterIndex) { MethodParameter param = new SynthesizingMethodParameter(this.handleMethod, parameterIndex); param.initParameterNameDiscovery(new DefaultParameterNameDiscoverer()); - GenericTypeResolver.resolveParameterType(param, this.resolver.getClass()); - return param; + return param.withContainingClass(this.resolver.getClass()); }