Repackage output capture and always use extension declaratively

Closes gh-17029
This commit is contained in:
Andy Wilkinson
2019-05-31 10:03:02 +01:00
parent d11d5ceb29
commit 0644a79401
69 changed files with 584 additions and 657 deletions

View File

@@ -37,7 +37,7 @@ import org.springframework.boot.devtools.remote.server.Dispatcher;
import org.springframework.boot.devtools.remote.server.DispatcherFilter;
import org.springframework.boot.devtools.restart.MockRestarter;
import org.springframework.boot.devtools.restart.RestartScopeInitializer;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
@@ -65,7 +65,7 @@ public class RemoteClientConfigurationTests {
public MockRestarter restarter = new MockRestarter();
@Rule
public OutputCapture output = new OutputCapture();
public OutputCaptureRule output = new OutputCaptureRule();
private AnnotationConfigServletWebServerApplicationContext context;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -28,7 +28,7 @@ import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.test.util.ReflectionTestUtils;
@@ -50,7 +50,7 @@ public class RestartApplicationListenerTests {
private static final String[] ARGS = new String[] { "a", "b", "c" };
@Rule
public final OutputCapture output = new OutputCapture();
public final OutputCaptureRule output = new OutputCaptureRule();
@Before
@After
@@ -86,7 +86,6 @@ public class RestartApplicationListenerTests {
@Test
public void disableWithSystemProperty() {
System.setProperty(ENABLED_PROPERTY, "false");
this.output.reset();
testInitialize(false);
assertThat(Restarter.getInstance()).hasFieldOrPropertyWithValue("enabled", false);
assertThat(this.output.toString())

View File

@@ -31,7 +31,7 @@ import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.devtools.restart.classloader.ClassLoaderFile;
import org.springframework.boot.devtools.restart.classloader.ClassLoaderFile.Kind;
import org.springframework.boot.devtools.restart.classloader.ClassLoaderFiles;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.event.ContextClosedEvent;
@@ -57,7 +57,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
public class RestarterTests {
@Rule
public OutputCapture out = new OutputCapture();
public OutputCaptureRule out = new OutputCaptureRule();
@Before
public void setup() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 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.
@@ -33,7 +33,7 @@ import org.mockito.MockitoAnnotations;
import org.springframework.boot.devtools.test.MockClientHttpRequestFactory;
import org.springframework.boot.devtools.tunnel.client.HttpTunnelConnection.TunnelChannel;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.http.HttpStatus;
import static org.assertj.core.api.Assertions.assertThat;
@@ -53,7 +53,7 @@ import static org.mockito.Mockito.verify;
public class HttpTunnelConnectionTests {
@Rule
public OutputCapture outputCapture = new OutputCapture();
public OutputCaptureRule outputCapture = new OutputCaptureRule();
private String url;