From a7663c88d343dfb9d51a850bb7028fbce8c19205 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Sun, 28 Jan 2018 17:29:35 +0100 Subject: [PATCH] Replace casted Mockito.any() calls Closes gh-11817 --- .../security/AuthenticationAuditListenerTests.java | 4 ++-- .../client/RemoteClientConfigurationTests.java | 6 +++--- .../boot/devtools/restart/MockRestarter.java | 4 ++-- .../OnInitializedRestarterConditionTests.java | 4 ++-- .../mockito/MockitoTestExecutionListenerTests.java | 4 ++-- .../RootUriRequestExpectationManagerTests.java | 4 ++-- .../boot/test/web/client/TestRestTemplateTests.java | 4 ++-- .../web/servlet/MockServletWebServer.java | 6 +++--- ...ntReferenceCachingMetadataReaderFactoryTests.java | 6 +++--- .../boot/web/client/RestTemplateBuilderTests.java | 2 +- .../boot/web/client/RootUriTemplateHandlerTests.java | 4 ++-- .../UndertowServletWebServerFactoryTests.java | 6 +++--- .../servlet/AbstractFilterRegistrationBeanTests.java | 4 ++-- .../web/servlet/ServletRegistrationBeanTests.java | 10 +++++----- .../ServletWebServerApplicationContextTests.java | 12 ++++++------ .../server/AbstractServletWebServerFactoryTests.java | 2 +- 16 files changed, 41 insertions(+), 41 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java index a3c324a11d2..58bffa8baf8 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthenticationAuditListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -68,7 +68,7 @@ public class AuthenticationAuditListenerTests { this.listener.onApplicationEvent(new InteractiveAuthenticationSuccessEvent( new UsernamePasswordAuthenticationToken("user", "password"), getClass())); // No need to audit this one (it shadows a regular AuthenticationSuccessEvent) - verify(this.publisher, never()).publishEvent((ApplicationEvent) any()); + verify(this.publisher, never()).publishEvent(any(ApplicationEvent.class)); } @Test diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java index 76a699eabac..561f8f963e0 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/remote/client/RemoteClientConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -178,8 +178,8 @@ public class RemoteClientConfigurationTests { public Dispatcher dispatcher() throws IOException { Dispatcher dispatcher = mock(Dispatcher.class); - ServerHttpRequest anyRequest = (ServerHttpRequest) any(); - ServerHttpResponse anyResponse = (ServerHttpResponse) any(); + ServerHttpRequest anyRequest = any(ServerHttpRequest.class); + ServerHttpResponse anyResponse = any(ServerHttpResponse.class); given(dispatcher.handle(anyRequest, anyResponse)).willReturn(true); return dispatcher; } diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java index 06e0229bcce..2a78a0568c8 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/MockRestarter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -60,7 +60,7 @@ public class MockRestarter implements TestRule { private void setup() { Restarter.setInstance(this.mock); given(this.mock.getInitialUrls()).willReturn(new URL[] {}); - given(this.mock.getOrAddAttribute(anyString(), (ObjectFactory) any())) + given(this.mock.getOrAddAttribute(anyString(), any(ObjectFactory.class))) .willAnswer((invocation) -> { String name = (String) invocation.getArguments()[0]; ObjectFactory factory = (ObjectFactory) invocation.getArguments()[1]; diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/OnInitializedRestarterConditionTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/OnInitializedRestarterConditionTests.java index 9c8f76397a1..32ffe95160b 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/OnInitializedRestarterConditionTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/OnInitializedRestarterConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -78,7 +78,7 @@ public class OnInitializedRestarterConditionTests { public static void main(String... args) { RestartInitializer initializer = mock(RestartInitializer.class); - given(initializer.getInitialUrls((Thread) any())).willReturn(new URL[0]); + given(initializer.getInitialUrls(any(Thread.class))).willReturn(new URL[0]); Restarter.initialize(new String[0], false, initializer); ConfigurableApplicationContext context = new AnnotationConfigApplicationContext( Config.class); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListenerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListenerTests.java index fb1723bd40a..ae765e423f6 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListenerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/mock/mockito/MockitoTestExecutionListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -74,7 +74,7 @@ public class MockitoTestExecutionListenerTests { WithMockBean instance = new WithMockBean(); this.listener.prepareTestInstance(mockTestContext(instance)); verify(this.postProcessor).inject(this.fieldCaptor.capture(), eq(instance), - (MockDefinition) any()); + any(MockDefinition.class)); assertThat(this.fieldCaptor.getValue().getName()).isEqualTo("mockBean"); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java index 0760ff2ebca..d4bc3151429 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/RootUriRequestExpectationManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -118,7 +118,7 @@ public class RootUriRequestExpectationManagerTests { throws Exception { ClientHttpRequest request = mock(ClientHttpRequest.class); given(request.getURI()).willReturn(new URI(this.uri + "/hello")); - given(this.delegate.validateRequest((ClientHttpRequest) any())) + given(this.delegate.validateRequest(any(ClientHttpRequest.class))) .willThrow(new AssertionError( "Request URI expected: was:")); this.thrown.expect(AssertionError.class); diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java index e7143a42651..616a957d9cb 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/web/client/TestRestTemplateTests.java @@ -336,7 +336,7 @@ public class TestRestTemplateTests { request.setResponse(new MockClientHttpResponse(new byte[0], HttpStatus.OK)); URI absoluteUri = URI .create("http://localhost:8080/a/b/c.txt?param=%7Bsomething%7D"); - given(requestFactory.createRequest(eq(absoluteUri), (HttpMethod) any())) + given(requestFactory.createRequest(eq(absoluteUri), any(HttpMethod.class))) .willReturn(request); RestTemplate delegate = new RestTemplate(); TestRestTemplate template = new TestRestTemplate(delegate); @@ -346,7 +346,7 @@ public class TestRestTemplateTests { template.setUriTemplateHandler(uriTemplateHandler); callback.doWithTestRestTemplate(template, URI.create("/a/b/c.txt?param=%7Bsomething%7D")); - verify(requestFactory).createRequest(eq(absoluteUri), (HttpMethod) any()); + verify(requestFactory).createRequest(eq(absoluteUri), any(HttpMethod.class)); } private void assertBasicAuthorizationInterceptorCredentials( diff --git a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/web/servlet/MockServletWebServer.java b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/web/servlet/MockServletWebServer.java index 43ec5ce8bd7..aad80de6ad1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/web/servlet/MockServletWebServer.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/web/servlet/MockServletWebServer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -66,7 +66,7 @@ public abstract class MockServletWebServer { private void initialize() { try { this.servletContext = mock(ServletContext.class); - given(this.servletContext.addServlet(anyString(), (Servlet) any())) + given(this.servletContext.addServlet(anyString(), any(Servlet.class))) .willAnswer((invocation) -> { RegisteredServlet registeredServlet = new RegisteredServlet( (Servlet) invocation.getArguments()[1]); @@ -74,7 +74,7 @@ public abstract class MockServletWebServer { .add(registeredServlet); return registeredServlet.getRegistration(); }); - given(this.servletContext.addFilter(anyString(), (Filter) any())) + given(this.servletContext.addFilter(anyString(), any(Filter.class))) .willAnswer((invocation) -> { RegisteredFilter registeredFilter = new RegisteredFilter( (Filter) invocation.getArguments()[1]); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactoryTests.java index a878ddfed31..ab37d6a5b1a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/type/classreading/ConcurrentReferenceCachingMetadataReaderFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -43,7 +43,7 @@ public class ConcurrentReferenceCachingMetadataReaderFactoryTests { MetadataReader metadataReader1 = factory.getMetadataReader(getClass().getName()); MetadataReader metadataReader2 = factory.getMetadataReader(getClass().getName()); assertThat(metadataReader1).isSameAs(metadataReader2); - verify(factory, times(1)).createMetadataReader((Resource) any()); + verify(factory, times(1)).createMetadataReader(any(Resource.class)); } @Test @@ -54,7 +54,7 @@ public class ConcurrentReferenceCachingMetadataReaderFactoryTests { factory.clearCache(); MetadataReader metadataReader2 = factory.getMetadataReader(getClass().getName()); assertThat(metadataReader1).isNotEqualTo(sameInstance(metadataReader2)); - verify(factory, times(2)).createMetadataReader((Resource) any()); + verify(factory, times(2)).createMetadataReader(any(Resource.class)); } private static class TestConcurrentReferenceCachingMetadataReaderFactory diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java index a0052c203c3..d94e3f95573 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java @@ -350,7 +350,7 @@ public class RestTemplateBuilderTests { public void customizersShouldBeAppliedLast() { RestTemplate template = spy(new RestTemplate()); this.builder.additionalCustomizers((restTemplate) -> verify(restTemplate) - .setRequestFactory((ClientHttpRequestFactory) any())); + .setRequestFactory(any(ClientHttpRequestFactory.class))); this.builder.configure(template); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java index d3b4ab91f25..5706aeb7f16 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RootUriTemplateHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -61,7 +61,7 @@ public class RootUriTemplateHandlerTests { this.uri = new URI("http://example.com/hello"); this.handler = new RootUriTemplateHandler("http://example.com", this.delegate); given(this.delegate.expand(anyString(), any(Map.class))).willReturn(this.uri); - given(this.delegate.expand(anyString(), (Object[]) any())).willReturn(this.uri); + given(this.delegate.expand(anyString(), any(Object[].class))).willReturn(this.uri); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java index 2f59a6fa828..ebc10d2988f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -106,7 +106,7 @@ public class UndertowServletWebServerFactoryTests this.webServer = factory.getWebServer(); InOrder ordered = inOrder((Object[]) customizers); for (UndertowBuilderCustomizer customizer : customizers) { - ordered.verify(customizer).customize((Builder) any()); + ordered.verify(customizer).customize(any(Builder.class)); } } @@ -139,7 +139,7 @@ public class UndertowServletWebServerFactoryTests this.webServer = factory.getWebServer(); InOrder ordered = inOrder((Object[]) customizers); for (UndertowDeploymentInfoCustomizer customizer : customizers) { - ordered.verify(customizer).customize((DeploymentInfo) any()); + ordered.verify(customizer).customize(any(DeploymentInfo.class)); } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java index aed11f71a5e..61ae6dabce8 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/AbstractFilterRegistrationBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -61,7 +61,7 @@ public abstract class AbstractFilterRegistrationBeanTests { @Before public void setupMocks() { MockitoAnnotations.initMocks(this); - given(this.servletContext.addFilter(anyString(), (Filter) any())) + given(this.servletContext.addFilter(anyString(), any(Filter.class))) .willReturn(this.registration); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java index 3b3934e355b..b955bd1f153 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/ServletRegistrationBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -68,9 +68,9 @@ public class ServletRegistrationBeanTests { @Before public void setupMocks() { MockitoAnnotations.initMocks(this); - given(this.servletContext.addServlet(anyString(), (Servlet) any())) + given(this.servletContext.addServlet(anyString(), any(Servlet.class))) .willReturn(this.registration); - given(this.servletContext.addFilter(anyString(), (Filter) any())) + given(this.servletContext.addFilter(anyString(), any(Filter.class))) .willReturn(this.filterRegistration); } @@ -88,7 +88,7 @@ public class ServletRegistrationBeanTests { public void startupWithDoubleRegistration() throws Exception { ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet); - given(this.servletContext.addServlet(anyString(), (Servlet) any())) + given(this.servletContext.addServlet(anyString(), any(Servlet.class))) .willReturn(null); bean.onStartup(this.servletContext); verify(this.servletContext).addServlet("mockServlet", this.servlet); @@ -207,7 +207,7 @@ public class ServletRegistrationBeanTests { ServletRegistrationBean bean = new ServletRegistrationBean<>( this.servlet, false); bean.onStartup(this.servletContext); - verify(this.registration, never()).addMapping((String[]) any()); + verify(this.registration, never()).addMapping(any(String[].class)); } } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java index 0bdfdead682..44ef0f35d07 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -371,8 +371,8 @@ public class ServletWebServerApplicationContextTests { this.context.refresh(); ServletContext servletContext = getWebServerFactory().getServletContext(); verify(initializer).onStartup(servletContext); - verify(servletContext).addServlet(anyString(), (Servlet) any()); - verify(servletContext).addFilter(anyString(), (Filter) any()); + verify(servletContext).addServlet(anyString(), any(Servlet.class)); + verify(servletContext).addFilter(anyString(), any(Filter.class)); } @Test @@ -388,8 +388,8 @@ public class ServletWebServerApplicationContextTests { this.context.registerBeanDefinition("filterBean", beanDefinition(filter)); this.context.refresh(); ServletContext servletContext = getWebServerFactory().getServletContext(); - verify(servletContext, atMost(1)).addServlet(anyString(), (Servlet) any()); - verify(servletContext, atMost(1)).addFilter(anyString(), (Filter) any()); + verify(servletContext, atMost(1)).addServlet(anyString(), any(Servlet.class)); + verify(servletContext, atMost(1)).addFilter(anyString(), any(Filter.class)); } @Test @@ -402,7 +402,7 @@ public class ServletWebServerApplicationContextTests { this.context.registerBeanDefinition("filterBean", beanDefinition(filter)); this.context.refresh(); ServletContext servletContext = getWebServerFactory().getServletContext(); - verify(servletContext, atMost(1)).addFilter(anyString(), (Filter) any()); + verify(servletContext, atMost(1)).addFilter(anyString(), any(Filter.class)); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index 7900734787c..f5d51b7220a 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -313,7 +313,7 @@ public abstract class AbstractServletWebServerFactoryTests { this.webServer.start(); InOrder ordered = inOrder((Object[]) initializers); for (ServletContextInitializer initializer : initializers) { - ordered.verify(initializer).onStartup((ServletContext) any()); + ordered.verify(initializer).onStartup(any(ServletContext.class)); } }