diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java index e1a479180d5..faede699dde 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java @@ -65,6 +65,8 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.protocol.HttpContext; import org.apache.http.ssl.SSLContextBuilder; 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; @@ -86,6 +88,7 @@ import org.springframework.http.client.ClientHttpRequest; import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.HttpComponentsAsyncClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.test.util.ReflectionTestUtils; import org.springframework.util.FileCopyUtils; import org.springframework.util.SocketUtils; import org.springframework.util.StreamUtils; @@ -118,6 +121,12 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { private final HttpClientContext httpClientContext = HttpClientContext.create(); + @BeforeClass + @AfterClass + public static void uninstallUrlStreamHandlerFactory() { + ReflectionTestUtils.setField(URL.class, "factory", null); + } + @After public void tearDown() { if (this.container != null) { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java index 3ac82b9e10b..f63ab4a3def 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java @@ -17,7 +17,6 @@ package org.springframework.boot.context.embedded.jetty; import java.io.IOException; -import java.net.URL; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -38,8 +37,6 @@ import org.eclipse.jetty.servlet.ServletHolder; import org.eclipse.jetty.util.thread.ThreadPool; import org.eclipse.jetty.webapp.Configuration; import org.eclipse.jetty.webapp.WebAppContext; -import org.junit.AfterClass; -import org.junit.BeforeClass; import org.junit.Test; import org.mockito.InOrder; @@ -49,7 +46,6 @@ import org.springframework.boot.context.embedded.Compression; import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.http.HttpHeaders; -import org.springframework.test.util.ReflectionTestUtils; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.anyObject; @@ -68,12 +64,6 @@ import static org.mockito.Mockito.mock; public class JettyEmbeddedServletContainerFactoryTests extends AbstractEmbeddedServletContainerFactoryTests { - @BeforeClass - @AfterClass - public static void uninstallUrlStreamHandlerFactory() { - ReflectionTestUtils.setField(URL.class, "factory", null); - } - @Override protected JettyEmbeddedServletContainerFactory getFactory() { return new JettyEmbeddedServletContainerFactory(0);