Rename internal OutputCapture classes

Rename the internal versions of OutputCapture to prevent accidental
import.

See gh-5492
pull/5497/head
Phillip Webb 9 years ago
parent f96cd144dc
commit faba7a9514

@ -30,7 +30,7 @@ import org.junit.runners.model.Statement;
*
* @author Phillip Webb
*/
public class OutputCapture implements TestRule {
class InternalOutputCapture implements TestRule {
private CaptureOutputStream captureOut;

@ -43,7 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class PropertiesLauncherTests {
@Rule
public OutputCapture output = new OutputCapture();
public InternalOutputCapture output = new InternalOutputCapture();
@Before
public void setup() throws IOException {

@ -22,7 +22,7 @@ import org.junit.After;
import org.junit.Rule;
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.annotation.Configuration;
import org.springframework.core.env.Environment;
@ -47,7 +47,7 @@ public class BannerTests {
}
@Rule
public OutputCapture out = new OutputCapture();
public InternalOutputCapture out = new InternalOutputCapture();
@Test
public void testDefaultBanner() throws Exception {

@ -23,7 +23,7 @@ import java.util.List;
import org.junit.Rule;
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.util.ClassUtils;
import org.springframework.util.StringUtils;
@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class SimpleMainTests {
@Rule
public OutputCapture outputCapture = new OutputCapture();
public InternalOutputCapture outputCapture = new InternalOutputCapture();
private static final String SPRING_STARTUP = "root of context hierarchy";

@ -43,7 +43,7 @@ import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEven
import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent;
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.ApplicationContextAware;
import org.springframework.context.ApplicationContextInitializer;
@ -99,7 +99,7 @@ public class SpringApplicationTests {
public ExpectedException thrown = ExpectedException.none();
@Rule
public OutputCapture output = new OutputCapture();
public InternalOutputCapture output = new InternalOutputCapture();
private ConfigurableApplicationContext context;

@ -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.real.InRealButScanningProblemPackages;
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 static org.assertj.core.api.Assertions.assertThat;
@ -52,7 +52,7 @@ public class ConfigurationWarningsApplicationContextInitializerTests {
+ "start due to a @ComponentScan of 'org.springframework'.";
@Rule
public OutputCapture output = new OutputCapture();
public InternalOutputCapture output = new InternalOutputCapture();
@Test
public void logWarningInDefaultPackage() {

@ -46,7 +46,7 @@ import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEven
import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.boot.env.EnumerableCompositePropertySource;
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.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
@ -86,7 +86,7 @@ public class ConfigFileApplicationListenerTests {
public ExpectedException expected = ExpectedException.none();
@Rule
public OutputCapture out = new OutputCapture();
public InternalOutputCapture out = new InternalOutputCapture();
private ConfigurableApplicationContext context;

@ -45,7 +45,7 @@ import org.springframework.boot.context.embedded.AbstractEmbeddedServletContaine
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactoryTests;
import org.springframework.boot.context.embedded.EmbeddedServletContainerException;
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.util.SocketUtils;
@ -70,7 +70,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
extends AbstractEmbeddedServletContainerFactoryTests {
@Rule
public OutputCapture outputCapture = new OutputCapture();
public InternalOutputCapture outputCapture = new InternalOutputCapture();
@Override
protected TomcatEmbeddedServletContainerFactory getFactory() {

@ -29,7 +29,7 @@ import org.junit.Rule;
import org.junit.Test;
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.mock.web.MockFilterChain;
import org.springframework.mock.web.MockFilterConfig;
@ -65,7 +65,7 @@ public class ErrorPageFilterTests {
private MockFilterChain chain = new MockFilterChain();
@Rule
public OutputCapture output = new OutputCapture();
public InternalOutputCapture output = new InternalOutputCapture();
@Test
public void notAnError() throws Exception {

@ -39,7 +39,7 @@ import org.springframework.boot.ApplicationPid;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationStartedEvent;
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.support.GenericApplicationContext;
import org.springframework.test.context.support.TestPropertySourceUtils;
@ -68,7 +68,7 @@ public class LoggingApplicationListenerTests {
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Rule
public OutputCapture outputCapture = new OutputCapture();
public InternalOutputCapture outputCapture = new InternalOutputCapture();
private final LoggingApplicationListener initializer = new LoggingApplicationListener();

@ -29,7 +29,7 @@ import org.junit.Test;
import org.springframework.boot.logging.AbstractLoggingSystemTests;
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.StringUtils;
@ -56,7 +56,7 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
getClass().getClassLoader());
@Rule
public OutputCapture output = new OutputCapture();
public InternalOutputCapture output = new InternalOutputCapture();
private Jdk14Logger logger;

@ -35,8 +35,8 @@ import org.junit.Test;
import org.springframework.boot.logging.AbstractLoggingSystemTests;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.boot.testutil.Matched;
import org.springframework.boot.testutil.OutputCapture;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
@ -54,7 +54,7 @@ import static org.hamcrest.Matchers.not;
public class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
@Rule
public OutputCapture output = new OutputCapture();
public InternalOutputCapture output = new InternalOutputCapture();
private final TestLog4J2LoggingSystem loggingSystem = new TestLog4J2LoggingSystem();

@ -39,8 +39,8 @@ import org.springframework.boot.logging.AbstractLoggingSystemTests;
import org.springframework.boot.logging.LogFile;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.LoggingInitializationContext;
import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.boot.testutil.Matched;
import org.springframework.boot.testutil.OutputCapture;
import org.springframework.mock.env.MockEnvironment;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
@ -59,7 +59,7 @@ import static org.hamcrest.Matchers.not;
public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
@Rule
public OutputCapture output = new OutputCapture();
public InternalOutputCapture output = new InternalOutputCapture();
private final LogbackLoggingSystem loggingSystem = new LogbackLoggingSystem(
getClass().getClassLoader());

@ -28,7 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.impl.StaticLoggerBinder;
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.test.context.support.TestPropertySourceUtils;
@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.not;
public class SpringBootJoranConfiguratorTests {
@Rule
public OutputCapture out = new OutputCapture();
public InternalOutputCapture out = new InternalOutputCapture();
private MockEnvironment environment;

@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.allOf;
* @author Phillip Webb
* @author Andy Wilkinson
*/
public class OutputCapture implements TestRule {
public class InternalOutputCapture implements TestRule {
private CaptureOutputStream captureOut;
@ -61,9 +61,9 @@ public class OutputCapture implements TestRule {
}
finally {
try {
if (!OutputCapture.this.matchers.isEmpty()) {
String output = OutputCapture.this.toString();
Assert.assertThat(output, allOf(OutputCapture.this.matchers));
if (!InternalOutputCapture.this.matchers.isEmpty()) {
String output = InternalOutputCapture.this.toString();
Assert.assertThat(output, allOf(InternalOutputCapture.this.matchers));
}
}
finally {
Loading…
Cancel
Save