Merge branch '2024' into 2024-gateway-cfg

pull/1582/head
Fishtail 4 months ago committed by GitHub
commit 1dddfdad7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,3 +3,4 @@
- feat:support spring cloud 2024.
- [fix: add gateway context config example.](https://github.com/Tencent/spring-cloud-tencent/pull/1582)

@ -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<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
@ -73,7 +74,7 @@ public class PolarisCircuitBreakerHttpResponseTest {
}
@Test
void testConstructorWithFallbackInfo() {
void testConstructorWithFallbackInfo() throws IOException {
Map<String, String> 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

Loading…
Cancel
Save