Commit faba7a95 authored by Phillip Webb's avatar Phillip Webb

Rename internal OutputCapture classes

Rename the internal versions of OutputCapture to prevent accidental
import.

See gh-5492
parent f96cd144
...@@ -30,7 +30,7 @@ import org.junit.runners.model.Statement; ...@@ -30,7 +30,7 @@ import org.junit.runners.model.Statement;
* *
* @author Phillip Webb * @author Phillip Webb
*/ */
public class OutputCapture implements TestRule { class InternalOutputCapture implements TestRule {
private CaptureOutputStream captureOut; private CaptureOutputStream captureOut;
......
...@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class PropertiesLauncherTests { public class PropertiesLauncherTests {
@Rule @Rule
public OutputCapture output = new OutputCapture(); public InternalOutputCapture output = new InternalOutputCapture();
@Before @Before
public void setup() throws IOException { public void setup() throws IOException {
......
...@@ -22,7 +22,7 @@ import org.junit.After; ...@@ -22,7 +22,7 @@ import org.junit.After;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
...@@ -47,7 +47,7 @@ public class BannerTests { ...@@ -47,7 +47,7 @@ public class BannerTests {
} }
@Rule @Rule
public OutputCapture out = new OutputCapture(); public InternalOutputCapture out = new InternalOutputCapture();
@Test @Test
public void testDefaultBanner() throws Exception { public void testDefaultBanner() throws Exception {
......
...@@ -23,7 +23,7 @@ import java.util.List; ...@@ -23,7 +23,7 @@ import java.util.List;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class SimpleMainTests { public class SimpleMainTests {
@Rule @Rule
public OutputCapture outputCapture = new OutputCapture(); public InternalOutputCapture outputCapture = new InternalOutputCapture();
private static final String SPRING_STARTUP = "root of context hierarchy"; private static final String SPRING_STARTUP = "root of context hierarchy";
......
...@@ -43,7 +43,7 @@ import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEven ...@@ -43,7 +43,7 @@ import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEven
import org.springframework.boot.context.event.ApplicationPreparedEvent; import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.context.event.ApplicationStartedEvent; import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ApplicationContextInitializer;
...@@ -99,7 +99,7 @@ public class SpringApplicationTests { ...@@ -99,7 +99,7 @@ public class SpringApplicationTests {
public ExpectedException thrown = ExpectedException.none(); public ExpectedException thrown = ExpectedException.none();
@Rule @Rule
public OutputCapture output = new OutputCapture(); public InternalOutputCapture output = new InternalOutputCapture();
private ConfigurableApplicationContext context; private ConfigurableApplicationContext context;
......
...@@ -33,7 +33,7 @@ import org.springframework.boot.context.configwarnings.dflt.InDefaultPackageWith ...@@ -33,7 +33,7 @@ import org.springframework.boot.context.configwarnings.dflt.InDefaultPackageWith
import org.springframework.boot.context.configwarnings.orgspring.InOrgSpringPackageConfiguration; import org.springframework.boot.context.configwarnings.orgspring.InOrgSpringPackageConfiguration;
import org.springframework.boot.context.configwarnings.real.InRealButScanningProblemPackages; import org.springframework.boot.context.configwarnings.real.InRealButScanningProblemPackages;
import org.springframework.boot.context.configwarnings.real.InRealPackageConfiguration; import org.springframework.boot.context.configwarnings.real.InRealPackageConfiguration;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
...@@ -52,7 +52,7 @@ public class ConfigurationWarningsApplicationContextInitializerTests { ...@@ -52,7 +52,7 @@ public class ConfigurationWarningsApplicationContextInitializerTests {
+ "start due to a @ComponentScan of 'org.springframework'."; + "start due to a @ComponentScan of 'org.springframework'.";
@Rule @Rule
public OutputCapture output = new OutputCapture(); public InternalOutputCapture output = new InternalOutputCapture();
@Test @Test
public void logWarningInDefaultPackage() { public void logWarningInDefaultPackage() {
......
...@@ -46,7 +46,7 @@ import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEven ...@@ -46,7 +46,7 @@ import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEven
import org.springframework.boot.context.event.ApplicationPreparedEvent; import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.boot.env.EnumerableCompositePropertySource; import org.springframework.boot.env.EnumerableCompositePropertySource;
import org.springframework.boot.env.EnvironmentPostProcessor; import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -86,7 +86,7 @@ public class ConfigFileApplicationListenerTests { ...@@ -86,7 +86,7 @@ public class ConfigFileApplicationListenerTests {
public ExpectedException expected = ExpectedException.none(); public ExpectedException expected = ExpectedException.none();
@Rule @Rule
public OutputCapture out = new OutputCapture(); public InternalOutputCapture out = new InternalOutputCapture();
private ConfigurableApplicationContext context; private ConfigurableApplicationContext context;
......
...@@ -45,7 +45,7 @@ import org.springframework.boot.context.embedded.AbstractEmbeddedServletContaine ...@@ -45,7 +45,7 @@ import org.springframework.boot.context.embedded.AbstractEmbeddedServletContaine
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactoryTests; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactoryTests;
import org.springframework.boot.context.embedded.EmbeddedServletContainerException; import org.springframework.boot.context.embedded.EmbeddedServletContainerException;
import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.Ssl;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.SocketUtils; import org.springframework.util.SocketUtils;
...@@ -70,7 +70,7 @@ public class TomcatEmbeddedServletContainerFactoryTests ...@@ -70,7 +70,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
extends AbstractEmbeddedServletContainerFactoryTests { extends AbstractEmbeddedServletContainerFactoryTests {
@Rule @Rule
public OutputCapture outputCapture = new OutputCapture(); public InternalOutputCapture outputCapture = new InternalOutputCapture();
@Override @Override
protected TomcatEmbeddedServletContainerFactory getFactory() { protected TomcatEmbeddedServletContainerFactory getFactory() {
......
...@@ -29,7 +29,7 @@ import org.junit.Rule; ...@@ -29,7 +29,7 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.context.embedded.ErrorPage; import org.springframework.boot.context.embedded.ErrorPage;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.mock.web.MockFilterChain; import org.springframework.mock.web.MockFilterChain;
import org.springframework.mock.web.MockFilterConfig; import org.springframework.mock.web.MockFilterConfig;
...@@ -65,7 +65,7 @@ public class ErrorPageFilterTests { ...@@ -65,7 +65,7 @@ public class ErrorPageFilterTests {
private MockFilterChain chain = new MockFilterChain(); private MockFilterChain chain = new MockFilterChain();
@Rule @Rule
public OutputCapture output = new OutputCapture(); public InternalOutputCapture output = new InternalOutputCapture();
@Test @Test
public void notAnError() throws Exception { public void notAnError() throws Exception {
......
...@@ -39,7 +39,7 @@ import org.springframework.boot.ApplicationPid; ...@@ -39,7 +39,7 @@ import org.springframework.boot.ApplicationPid;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationStartedEvent; import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.boot.logging.java.JavaLoggingSystem; import org.springframework.boot.logging.java.JavaLoggingSystem;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.context.event.ContextClosedEvent; import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.support.GenericApplicationContext; import org.springframework.context.support.GenericApplicationContext;
import org.springframework.test.context.support.TestPropertySourceUtils; import org.springframework.test.context.support.TestPropertySourceUtils;
...@@ -68,7 +68,7 @@ public class LoggingApplicationListenerTests { ...@@ -68,7 +68,7 @@ public class LoggingApplicationListenerTests {
public TemporaryFolder temporaryFolder = new TemporaryFolder(); public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Rule @Rule
public OutputCapture outputCapture = new OutputCapture(); public InternalOutputCapture outputCapture = new InternalOutputCapture();
private final LoggingApplicationListener initializer = new LoggingApplicationListener(); private final LoggingApplicationListener initializer = new LoggingApplicationListener();
......
...@@ -29,7 +29,7 @@ import org.junit.Test; ...@@ -29,7 +29,7 @@ import org.junit.Test;
import org.springframework.boot.logging.AbstractLoggingSystemTests; import org.springframework.boot.logging.AbstractLoggingSystemTests;
import org.springframework.boot.logging.LogLevel; import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -56,7 +56,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests { ...@@ -56,7 +56,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
getClass().getClassLoader()); getClass().getClassLoader());
@Rule @Rule
public OutputCapture output = new OutputCapture(); public InternalOutputCapture output = new InternalOutputCapture();
private Jdk14Logger logger; private Jdk14Logger logger;
......
...@@ -35,8 +35,8 @@ import org.junit.Test; ...@@ -35,8 +35,8 @@ import org.junit.Test;
import org.springframework.boot.logging.AbstractLoggingSystemTests; import org.springframework.boot.logging.AbstractLoggingSystemTests;
import org.springframework.boot.logging.LogLevel; import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.boot.testutil.Matched; import org.springframework.boot.testutil.Matched;
import org.springframework.boot.testutil.OutputCapture;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -54,7 +54,7 @@ import static org.hamcrest.Matchers.not; ...@@ -54,7 +54,7 @@ import static org.hamcrest.Matchers.not;
public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests { public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
@Rule @Rule
public OutputCapture output = new OutputCapture(); public InternalOutputCapture output = new InternalOutputCapture();
private final TestLog4J2LoggingSystem loggingSystem = new TestLog4J2LoggingSystem(); private final TestLog4J2LoggingSystem loggingSystem = new TestLog4J2LoggingSystem();
......
...@@ -39,8 +39,8 @@ import org.springframework.boot.logging.AbstractLoggingSystemTests; ...@@ -39,8 +39,8 @@ import org.springframework.boot.logging.AbstractLoggingSystemTests;
import org.springframework.boot.logging.LogFile; import org.springframework.boot.logging.LogFile;
import org.springframework.boot.logging.LogLevel; import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.LoggingInitializationContext; import org.springframework.boot.logging.LoggingInitializationContext;
import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.boot.testutil.Matched; import org.springframework.boot.testutil.Matched;
import org.springframework.boot.testutil.OutputCapture;
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -59,7 +59,7 @@ import static org.hamcrest.Matchers.not; ...@@ -59,7 +59,7 @@ import static org.hamcrest.Matchers.not;
public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
@Rule @Rule
public OutputCapture output = new OutputCapture(); public InternalOutputCapture output = new InternalOutputCapture();
private final LogbackLoggingSystem loggingSystem = new LogbackLoggingSystem( private final LogbackLoggingSystem loggingSystem = new LogbackLoggingSystem(
getClass().getClassLoader()); getClass().getClassLoader());
......
...@@ -28,7 +28,7 @@ import org.slf4j.Logger; ...@@ -28,7 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.impl.StaticLoggerBinder; import org.slf4j.impl.StaticLoggerBinder;
import org.springframework.boot.logging.LoggingInitializationContext; import org.springframework.boot.logging.LoggingInitializationContext;
import org.springframework.boot.testutil.OutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
import org.springframework.test.context.support.TestPropertySourceUtils; import org.springframework.test.context.support.TestPropertySourceUtils;
...@@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.not; ...@@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.not;
public class SpringBootJoranConfiguratorTests { public class SpringBootJoranConfiguratorTests {
@Rule @Rule
public OutputCapture out = new OutputCapture(); public InternalOutputCapture out = new InternalOutputCapture();
private MockEnvironment environment; private MockEnvironment environment;
......
...@@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.allOf; ...@@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.allOf;
* @author Phillip Webb * @author Phillip Webb
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
public class OutputCapture implements TestRule { public class InternalOutputCapture implements TestRule {
private CaptureOutputStream captureOut; private CaptureOutputStream captureOut;
...@@ -61,9 +61,9 @@ public class OutputCapture implements TestRule { ...@@ -61,9 +61,9 @@ public class OutputCapture implements TestRule {
} }
finally { finally {
try { try {
if (!OutputCapture.this.matchers.isEmpty()) { if (!InternalOutputCapture.this.matchers.isEmpty()) {
String output = OutputCapture.this.toString(); String output = InternalOutputCapture.this.toString();
Assert.assertThat(output, allOf(OutputCapture.this.matchers)); Assert.assertThat(output, allOf(InternalOutputCapture.this.matchers));
} }
} }
finally { finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment