From a47f232fb14c1d13710f30c884e56a021abc8111 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Tue, 10 Dec 2019 15:20:06 -0500 Subject: [PATCH] Migrates to new OutputCaptureRule --- .../RetryGatewayFilterFactoryIntegrationTests.java | 10 ++-------- .../handler/RoutePredicateHandlerMappingTests.java | 4 ++-- .../predicate/QueryRoutePredicateFactoryTests.java | 4 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/filter/factory/RetryGatewayFilterFactoryIntegrationTests.java b/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/filter/factory/RetryGatewayFilterFactoryIntegrationTests.java index 996ffff15..fbb083235 100644 --- a/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/filter/factory/RetryGatewayFilterFactoryIntegrationTests.java +++ b/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/filter/factory/RetryGatewayFilterFactoryIntegrationTests.java @@ -27,7 +27,6 @@ import com.netflix.loadbalancer.ServerList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hamcrest.CoreMatchers; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -37,7 +36,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.rule.OutputCapture; +import org.springframework.boot.test.system.OutputCaptureRule; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway.filter.factory.RetryGatewayFilterFactory.RetryConfig; @@ -75,12 +74,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen public class RetryGatewayFilterFactoryIntegrationTests extends BaseWebClientTests { @Rule - public final OutputCapture capture = new OutputCapture(); - - @Before - public void before() { - capture.reset(); - } + public final OutputCaptureRule capture = new OutputCaptureRule(); @Test public void retryFilterGet() { diff --git a/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/handler/RoutePredicateHandlerMappingTests.java b/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/handler/RoutePredicateHandlerMappingTests.java index d4bd3ece3..99c6855cf 100644 --- a/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/handler/RoutePredicateHandlerMappingTests.java +++ b/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/handler/RoutePredicateHandlerMappingTests.java @@ -23,7 +23,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -import org.springframework.boot.test.rule.OutputCapture; +import org.springframework.boot.test.system.OutputCaptureRule; import org.springframework.cloud.gateway.config.GlobalCorsProperties; import org.springframework.cloud.gateway.route.Route; import org.springframework.cloud.gateway.route.RouteLocator; @@ -38,7 +38,7 @@ import static org.hamcrest.Matchers.containsString; public class RoutePredicateHandlerMappingTests { @Rule - public OutputCapture outputCapture = new OutputCapture(); + public OutputCaptureRule outputCapture = new OutputCaptureRule(); @Test public void lookupRouteFromSyncPredicates() { diff --git a/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/handler/predicate/QueryRoutePredicateFactoryTests.java b/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/handler/predicate/QueryRoutePredicateFactoryTests.java index d54067558..2c5f50be4 100644 --- a/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/handler/predicate/QueryRoutePredicateFactoryTests.java +++ b/spring-cloud-gateway-core/src/test/java/org/springframework/cloud/gateway/handler/predicate/QueryRoutePredicateFactoryTests.java @@ -26,7 +26,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringBootConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.rule.OutputCapture; +import org.springframework.boot.test.system.OutputCaptureRule; import org.springframework.cloud.gateway.handler.predicate.QueryRoutePredicateFactory.Config; import org.springframework.cloud.gateway.route.RouteLocator; import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder; @@ -47,7 +47,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen public class QueryRoutePredicateFactoryTests extends BaseWebClientTests { @Rule - public OutputCapture output = new OutputCapture(); + public OutputCaptureRule output = new OutputCaptureRule(); @Test public void noQueryParamWorks() {