Repackage output capture and always use extension declaratively
Closes gh-17029
This commit is contained in:
@@ -23,7 +23,7 @@ import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
@@ -44,7 +44,7 @@ import static org.mockito.Mockito.mock;
|
||||
public class SpringBootDependencyInjectionTestExecutionListenerTests {
|
||||
|
||||
@Rule
|
||||
public OutputCapture out = new OutputCapture();
|
||||
public OutputCaptureRule out = new OutputCaptureRule();
|
||||
|
||||
private SpringBootDependencyInjectionTestExecutionListener reportListener = new SpringBootDependencyInjectionTestExecutionListener();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMock
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrint;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.security.test.context.support.WithMockUser;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -49,7 +49,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
public class MockMvcSpringBootTestIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public OutputCapture output = new OutputCapture();
|
||||
public OutputCaptureRule output = new OutputCaptureRule();
|
||||
|
||||
@MockBean
|
||||
private ExampleMockableService service;
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||
import org.springframework.security.test.context.support.WithMockUser;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@@ -45,7 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
public class WebMvcTestPrintAlwaysIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public OutputCapture output = new OutputCapture();
|
||||
public OutputCaptureRule output = new OutputCaptureRule();
|
||||
|
||||
@Autowired
|
||||
private MockMvc mvc;
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||
import org.springframework.security.test.context.support.WithMockUser;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
@@ -45,7 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
public class WebMvcTestPrintDefaultOverrideIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public OutputCapture output = new OutputCapture();
|
||||
public OutputCaptureRule output = new OutputCaptureRule();
|
||||
|
||||
@Autowired
|
||||
private MockMvc mvc;
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.junit.runners.model.FrameworkMethod;
|
||||
import org.junit.runners.model.InitializationError;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
@@ -41,7 +41,7 @@ public class WebMvcTestPrintDefaultRunner extends SpringJUnit4ClassRunner {
|
||||
protected Statement methodBlock(FrameworkMethod frameworkMethod) {
|
||||
Statement statement = super.methodBlock(frameworkMethod);
|
||||
statement = new AlwaysPassStatement(statement);
|
||||
OutputCapture outputCapture = new OutputCapture();
|
||||
OutputCaptureRule outputCapture = new OutputCaptureRule();
|
||||
if (frameworkMethod.getName().equals("shouldPrint")) {
|
||||
outputCapture.expect(containsString("HTTP Method"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user