diff --git a/CHANGELOG.md b/CHANGELOG.md index 38d0ad82a..9b0c54d8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,3 +3,4 @@ - feat:support spring cloud 2024. - [fix: add gateway context config example.](https://github.com/Tencent/spring-cloud-tencent/pull/1582) + diff --git a/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/instrument/resttemplate/PolarisCircuitBreakerHttpResponseTest.java b/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/instrument/resttemplate/PolarisCircuitBreakerHttpResponseTest.java index 74ee18be4..c2aba130d 100644 --- a/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/instrument/resttemplate/PolarisCircuitBreakerHttpResponseTest.java +++ b/spring-cloud-starter-tencent-polaris-circuitbreaker/src/test/java/com/tencent/cloud/polaris/circuitbreaker/instrument/resttemplate/PolarisCircuitBreakerHttpResponseTest.java @@ -17,6 +17,7 @@ package com.tencent.cloud.polaris.circuitbreaker.instrument.resttemplate; +import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; @@ -35,7 +36,7 @@ import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) public class PolarisCircuitBreakerHttpResponseTest { @Test - void testConstructorWithCodeOnly() { + void testConstructorWithCodeOnly() throws IOException { PolarisCircuitBreakerHttpResponse response = new PolarisCircuitBreakerHttpResponse(200); Assertions.assertEquals(200, response.getStatusCode().value()); @@ -45,7 +46,7 @@ public class PolarisCircuitBreakerHttpResponseTest { } @Test - void testConstructorWithCodeAndBody() { + void testConstructorWithCodeAndBody() throws IOException { String body = "test body"; PolarisCircuitBreakerHttpResponse response = new PolarisCircuitBreakerHttpResponse(200, body); @@ -56,7 +57,7 @@ public class PolarisCircuitBreakerHttpResponseTest { } @Test - void testConstructorWithCodeHeadersAndBody() { + void testConstructorWithCodeHeadersAndBody() throws IOException { String body = "test body"; Map headers = new HashMap<>(); headers.put("Content-Type", "application/json"); @@ -73,7 +74,7 @@ public class PolarisCircuitBreakerHttpResponseTest { } @Test - void testConstructorWithFallbackInfo() { + void testConstructorWithFallbackInfo() throws IOException { Map headers = new HashMap<>(); headers.put("Content-Type", "application/json"); CircuitBreakerStatus.FallbackInfo fallbackInfo = new CircuitBreakerStatus.FallbackInfo(200, headers, "test body"); @@ -95,7 +96,9 @@ public class PolarisCircuitBreakerHttpResponseTest { @Test void testGetStatusTextWithInvalidHttpStatus() { - Assertions.assertThrows(IllegalArgumentException.class, () -> new PolarisCircuitBreakerHttpResponse(999).getStatusText()); + PolarisCircuitBreakerHttpResponse response = new PolarisCircuitBreakerHttpResponse(999); + //SCT 2024 will throw IllegalArgumentException when getStatusText() is called with invalid http status code + Assertions.assertThrows(IllegalArgumentException.class, () -> response.getStatusText()); } @Test