OutputCapture should be updated to OutputCaptureRule

resolves #615

In Boot 2.2.x they change the of OutputCapture and thus it was deprecated.
This commit is contained in:
Glenn Renfro
2019-07-15 15:28:50 -04:00
parent 7aa08f08e4
commit 4f1524a711
7 changed files with 16 additions and 15 deletions

View File

@@ -24,7 +24,7 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.cloud.task.configuration.EnableTask;
import org.springframework.cloud.task.configuration.SimpleTaskAutoConfiguration;
import org.springframework.context.ApplicationContextException;
@@ -62,7 +62,7 @@ public class TaskCoreTests {
* Used to capture the log output from the test task.
*/
@Rule
public OutputCapture outputCapture = new OutputCapture();
public OutputCaptureRule outputCapture = new OutputCaptureRule();
private ConfigurableApplicationContext applicationContext;

View File

@@ -34,7 +34,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.context.event.ApplicationFailedEvent;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.cloud.task.repository.TaskExecution;
import org.springframework.cloud.task.repository.TaskExplorer;
import org.springframework.cloud.task.util.TestDefaultConfiguration;
@@ -66,7 +66,7 @@ public class TaskLifecycleListenerTests {
* Used to capture the log output from the test task.
*/
@Rule
public OutputCapture outputCapture = new OutputCapture();
public OutputCaptureRule outputCapture = new OutputCaptureRule();
private AnnotationConfigApplicationContext context;

View File

@@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.cloud.task.repository.TaskExecution;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.argThat;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

View File

@@ -23,10 +23,11 @@ import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
/**
* Verifies that the Task Application outputs the correct task log entries.
@@ -36,7 +37,7 @@ import static junit.framework.Assert.assertTrue;
public class BatchJobApplicationTests {
@Rule
public OutputCapture outputCapture = new OutputCapture();
public OutputCaptureRule outputCapture = new OutputCaptureRule();
@Test
public void testBatchJobApp() throws Exception {

View File

@@ -28,7 +28,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
@@ -60,7 +60,7 @@ public class JpaApplicationTests {
}
@Rule
public OutputCapture outputCapture = new OutputCapture();
public OutputCaptureRule outputCapture = new OutputCaptureRule();
private ConfigurableApplicationContext context;
private DataSource dataSource;
private Server server;

View File

@@ -20,7 +20,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import static org.assertj.core.api.Assertions.assertThat;
@@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class MultiDataSourcesApplicationTests {
@Rule
public OutputCapture outputCapture = new OutputCapture();
public OutputCaptureRule outputCapture = new OutputCaptureRule();
@Test
public void testTimeStampApp() throws Exception {

View File

@@ -23,7 +23,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.test.rule.OutputCapture;
import org.springframework.boot.test.system.OutputCaptureRule;
import static org.assertj.core.api.Assertions.assertThat;
@@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class TaskApplicationTests {
@Rule
public OutputCapture outputCapture = new OutputCapture();
public OutputCaptureRule outputCapture = new OutputCaptureRule();
@Test
public void testTimeStampApp() throws Exception {