diff --git a/spring-cloud-gateway-server-mvc/src/test/java/org/springframework/cloud/gateway/server/mvc/ServerMvcIntegrationTests.java b/spring-cloud-gateway-server-mvc/src/test/java/org/springframework/cloud/gateway/server/mvc/ServerMvcIntegrationTests.java index 053a658e..64eb4cae 100644 --- a/spring-cloud-gateway-server-mvc/src/test/java/org/springframework/cloud/gateway/server/mvc/ServerMvcIntegrationTests.java +++ b/spring-cloud-gateway-server-mvc/src/test/java/org/springframework/cloud/gateway/server/mvc/ServerMvcIntegrationTests.java @@ -32,6 +32,7 @@ import io.github.bucket4j.distributed.proxy.AsyncProxyManager; import io.github.bucket4j.distributed.remote.RemoteBucketState; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -268,6 +269,18 @@ public class ServerMvcIntegrationTests { .isEqualTo(HttpStatus.GATEWAY_TIMEOUT); } + @Test + public void circuitBreakerInvalidFallbackThrowsException() { + // @formatter:off + Assertions.assertThatThrownBy(() -> route("testcircuitbreakergatewayfallback") + .route(path("/anything/circuitbreakergatewayfallback"), http(URI.create("https://nonexistantdomain.com1234"))) + .filter(circuitBreaker("mycb2", URI.create("http://example.com"))) + .build()).isInstanceOf(IllegalArgumentException.class); + // @formatter:on + } + + + @Test public void retryWorks() { restClient.get().uri("/retry?key=get").exchange().expectStatus().isOk().expectBody(String.class).isEqualTo("3"); @@ -747,7 +760,7 @@ public class ServerMvcIntegrationTests { // @formatter:off return route("testcircuitbreakergatewayfallback") .route(path("/anything/circuitbreakergatewayfallback"), http(URI.create("https://nonexistantdomain.com1234"))) - .filter(circuitBreaker("mycb2", "/anything/gatewayfallback")) + .filter(circuitBreaker("mycb2", URI.create("forward:/anything/gatewayfallback"))) .build() .and(route("testgatewayfallback") .route(path("/anything/gatewayfallback"), http())