From 3bda78a3d327bfedf486659712b4ee09216757c6 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 22 Nov 2018 20:27:19 +0000 Subject: [PATCH] Fix tests after HandlerExceptionResolver logging changes See gh-14936 and gh-15189 --- .../web/servlet/WebMvcAutoConfigurationTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java index d1e30f4fb0..3fc8fc5f4b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfigurationTests.java @@ -85,6 +85,7 @@ import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver; import org.springframework.web.servlet.i18n.FixedLocaleResolver; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter; import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; +import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver; import org.springframework.web.servlet.resource.AppCacheManifestTransformer; import org.springframework.web.servlet.resource.CachingResourceResolver; import org.springframework.web.servlet.resource.CachingResourceTransformer; @@ -573,7 +574,8 @@ public class WebMvcAutoConfigurationTests { List delegates = ((HandlerExceptionResolverComposite) resolver) .getExceptionResolvers(); for (HandlerExceptionResolver delegate : delegates) { - if (delegate instanceof AbstractHandlerExceptionResolver) { + if (delegate instanceof AbstractHandlerExceptionResolver + && !(delegate instanceof DefaultHandlerExceptionResolver)) { consumer.accept(ReflectionTestUtils.getField(delegate, "warnLogger")); } }