diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java index c73a7ed9b5..e43741e401 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfigurationServletContainerTests.java @@ -16,19 +16,14 @@ package org.springframework.boot.autoconfigure.jersey; -import java.net.URL; - import javax.ws.rs.GET; import javax.ws.rs.Path; import org.apache.catalina.Context; import org.apache.catalina.Wrapper; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.apache.tomcat.util.buf.UDecoder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletContainer; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; @@ -47,7 +42,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -65,14 +59,6 @@ public class JerseyAutoConfigurationServletContainerTests { @ClassRule public static OutputCapture output = new OutputCapture(); - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void existingJerseyServletIsAmended() { assertThat(output.toString()) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java index 5487e7440a..c64cbcb2a8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java @@ -17,16 +17,12 @@ package org.springframework.boot.autoconfigure.security; import java.io.IOException; -import java.net.URL; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.module.SimpleModule; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -47,7 +43,6 @@ import org.springframework.context.annotation.Import; import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.converter.Converter; import org.springframework.stereotype.Component; -import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -61,14 +56,6 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests { // gh-4154 - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void testSecurityFilterDoesNotCauseEarlyInitialization() throws Exception { AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java index d72cdd2a2f..06a575173a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java @@ -17,15 +17,11 @@ package org.springframework.boot.autoconfigure.security.oauth2; import java.net.URI; -import java.net.URL; import java.util.Arrays; import java.util.Base64; import java.util.List; import com.fasterxml.jackson.databind.JsonNode; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.aop.support.AopUtils; @@ -123,14 +119,6 @@ public class OAuth2AutoConfigurationTests { private AnnotationConfigServletWebServerApplicationContext context; - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void testDefaultConfiguration() { this.context = new AnnotationConfigServletWebServerApplicationContext(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java index 6559426cd4..81765a9c75 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/DefaultServletWebServerFactoryCustomizerTests.java @@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.web.servlet; import java.io.File; import java.io.IOException; -import java.net.URL; import java.util.EnumSet; import java.util.HashMap; import java.util.Locale; @@ -34,13 +33,10 @@ import org.apache.catalina.Context; import org.apache.catalina.Valve; import org.apache.catalina.valves.AccessLogValve; import org.apache.catalina.valves.RemoteIpValve; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.apache.coyote.AbstractProtocol; import org.eclipse.jetty.server.NCSARequestLog; import org.eclipse.jetty.server.RequestLog; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Captor; @@ -59,7 +55,6 @@ import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFa import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.mock.env.MockEnvironment; -import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyBoolean; @@ -90,14 +85,6 @@ public class DefaultServletWebServerFactoryCustomizerTests { this.customizer = new DefaultServletWebServerFactoryCustomizer(this.properties); } - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void tomcatAccessLogIsDisabledByDefault() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java index fdaee9031d..d99370a7cb 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfigurationTests.java @@ -17,13 +17,10 @@ package org.springframework.boot.autoconfigure.web.servlet; import java.net.URI; -import java.net.URL; import javax.servlet.MultipartConfigElement; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.junit.After; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -80,14 +77,6 @@ public class MultipartAutoConfigurationTests { } } - @Before - @After - public void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void webServerWithNothing() throws Exception { this.context = new AnnotationConfigServletWebServerApplicationContext( diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerServletContextListenerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerServletContextListenerTests.java index f91164197c..9dfd1fad21 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerServletContextListenerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/ServletWebServerServletContextListenerTests.java @@ -16,14 +16,9 @@ package org.springframework.boot.autoconfigure.web.servlet; -import java.net.URL; - import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; @@ -35,7 +30,6 @@ import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebSe import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.util.ReflectionTestUtils; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -48,14 +42,6 @@ import static org.mockito.Mockito.verify; */ public class ServletWebServerServletContextListenerTests { - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void registeredServletContextListenerBeanIsCalledByJetty() { registeredServletContextListenerBeanIsCalled(JettyConfiguration.class); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java index db9aba7696..71bcba7353 100755 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java @@ -22,7 +22,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.net.URI; -import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -33,10 +32,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import javax.validation.constraints.NotNull; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.junit.After; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.boot.SpringApplication; @@ -55,7 +51,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.RequestEntity; import org.springframework.http.ResponseEntity; -import org.springframework.test.util.ReflectionTestUtils; import org.springframework.validation.BindException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.PostMapping; @@ -86,14 +81,6 @@ public class BasicErrorControllerIntegrationTests { } } - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test @SuppressWarnings("rawtypes") public void testErrorForMachineClient() throws Exception { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java index 07c59c13d6..43293d1ad7 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfigurationTests.java @@ -16,15 +16,10 @@ package org.springframework.boot.autoconfigure.websocket; -import java.net.URL; - import javax.websocket.server.ServerContainer; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; @@ -34,7 +29,6 @@ import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebSe import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -59,14 +53,6 @@ public class WebSocketAutoConfigurationTests { } } - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void tomcatServerContainerIsAvailableFromTheServletContext() { serverContainerIsAvailableFromTheServletContext(TomcatConfiguration.class, diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java index ba9d6c7bf7..35eb5966e9 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/websocket/WebSocketMessagingAutoConfigurationTests.java @@ -17,7 +17,6 @@ package org.springframework.boot.autoconfigure.websocket; import java.lang.reflect.Type; -import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; @@ -27,12 +26,9 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.apache.tomcat.websocket.WsWebSocketContainer; import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; @@ -101,14 +97,6 @@ public class WebSocketMessagingAutoConfigurationTests { this.sockJsClient.stop(); } - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void basicMessagingWithJsonResponse() throws Throwable { Object result = performStompSubscription("/app/json"); diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java index ef0606a68d..9fa46465d0 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/integrationtest/HttpTunnelIntegrationTests.java @@ -16,13 +16,9 @@ package org.springframework.boot.devtools.integrationtest; -import java.net.URL; import java.util.Collection; import java.util.Collections; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -52,7 +48,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.test.util.ReflectionTestUtils; import org.springframework.util.SocketUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -73,14 +68,6 @@ public class HttpTunnelIntegrationTests { @Autowired private Config config; - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void httpServerDirect() throws Exception { String url = "http://localhost:" + this.config.httpServerPort + "/hello"; diff --git a/spring-boot-docs/src/test/java/org/springframework/boot/context/embedded/TomcatLegacyCookieProcessorExampleTests.java b/spring-boot-docs/src/test/java/org/springframework/boot/context/embedded/TomcatLegacyCookieProcessorExampleTests.java index 3d1626e03d..1a196e702f 100644 --- a/spring-boot-docs/src/test/java/org/springframework/boot/context/embedded/TomcatLegacyCookieProcessorExampleTests.java +++ b/spring-boot-docs/src/test/java/org/springframework/boot/context/embedded/TomcatLegacyCookieProcessorExampleTests.java @@ -16,13 +16,8 @@ package org.springframework.boot.context.embedded; -import java.net.URL; - import org.apache.catalina.Context; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.apache.tomcat.util.http.LegacyCookieProcessor; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.boot.SpringApplication; @@ -33,7 +28,6 @@ import org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostPro import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; @@ -44,14 +38,6 @@ import static org.assertj.core.api.Assertions.assertThat; */ public class TomcatLegacyCookieProcessorExampleTests { - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void cookieProcessorIsCustomized() { ServletWebServerApplicationContext applicationContext = (ServletWebServerApplicationContext) new SpringApplication( diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestWebServerWebEnvironmentTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestWebServerWebEnvironmentTests.java index b237737258..11f95f7bd2 100644 --- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestWebServerWebEnvironmentTests.java +++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/AbstractSpringBootTestWebServerWebEnvironmentTests.java @@ -16,13 +16,8 @@ package org.springframework.boot.test.context; -import java.net.URL; - import javax.servlet.ServletContext; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +28,6 @@ import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.test.util.ReflectionTestUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.client.RestTemplate; import org.springframework.web.context.WebApplicationContext; @@ -65,14 +59,6 @@ public abstract class AbstractSpringBootTestWebServerWebEnvironmentTests { @Autowired private TestRestTemplate restTemplate; - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - public WebApplicationContext getContext() { return this.context; } diff --git a/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java index c95ee71fff..4d64c4271c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/reactive/server/AbstractReactiveWebServerFactoryTests.java @@ -16,12 +16,7 @@ package org.springframework.boot.web.reactive.server; -import java.net.URL; - -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.junit.After; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -36,7 +31,6 @@ import org.springframework.http.MediaType; import org.springframework.http.server.reactive.HttpHandler; import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpResponse; -import org.springframework.test.util.ReflectionTestUtils; import org.springframework.util.SocketUtils; import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.client.ClientResponse; @@ -74,14 +68,6 @@ public abstract class AbstractReactiveWebServerFactoryTests { } } - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - protected abstract AbstractReactiveWebServerFactory getFactory(); @Test diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java index 3506421891..abd44b8471 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerMvcIntegrationTests.java @@ -17,13 +17,9 @@ package org.springframework.boot.web.servlet.context; import java.net.URI; -import java.net.URL; import java.nio.charset.Charset; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.junit.After; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory; @@ -42,7 +38,6 @@ import org.springframework.http.client.ClientHttpRequest; import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.stereotype.Controller; -import org.springframework.test.util.ReflectionTestUtils; import org.springframework.util.StreamUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -72,14 +67,6 @@ public class ServletWebServerMvcIntegrationTests { } } - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Test public void tomcat() throws Exception { this.context = new AnnotationConfigServletWebServerApplicationContext( diff --git a/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index 0594f6b46e..b9ba4e30de 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -59,7 +59,6 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; -import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.InputStreamFactory; import org.apache.http.client.protocol.HttpClientContext; @@ -73,9 +72,7 @@ import org.apache.http.ssl.TrustStrategy; import org.apache.jasper.EmbeddedServletOptions; import org.apache.jasper.servlet.JspServlet; import org.junit.After; -import org.junit.AfterClass; import org.junit.Assume; -import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -140,14 +137,6 @@ public abstract class AbstractServletWebServerFactoryTests { private final HttpClientContext httpClientContext = HttpClientContext.create(); - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(TomcatURLStreamHandlerFactory.class, "instance", - null); - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @After public void tearDown() { if (this.webServer != null) {