This is an automated email from the ASF dual-hosted git repository.
chenzhida pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new 2e1a12af3 Fix flaky should_include_code_in_json_when_code_is_not_null
(#4992)
2e1a12af3 is described below
commit 2e1a12af3be46fad275e9c274e89902c1ec69bf1
Author: Peizhao Mei <[email protected]>
AuthorDate: Mon Oct 27 02:42:59 2025 -0500
Fix flaky should_include_code_in_json_when_code_is_not_null (#4992)
Update import
---
.../swagger/invocation/exception/CommonExceptionDataTest.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git
a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java
b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java
index 39a071f1f..c12f149b8 100644
---
a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java
+++
b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java
@@ -20,6 +20,8 @@ package org.apache.servicecomb.swagger.invocation.exception;
import static com.google.common.collect.ImmutableMap.of;
import static org.assertj.core.api.Assertions.assertThat;
+import java.util.Map;
+
import org.junit.jupiter.api.Test;
import io.vertx.core.json.Json;
@@ -36,7 +38,11 @@ class CommonExceptionDataTest {
void should_include_code_in_json_when_code_is_not_null() {
CommonExceptionData data = new CommonExceptionData("code", "msg");
-
assertThat(Json.encode(data)).isEqualTo("{\"code\":\"code\",\"message\":\"msg\"}");
+ String json = Json.encode(data);
+ @SuppressWarnings("unchecked")
+ Map<String, Object> obj = Json.decodeValue(json, Map.class);
+
+ assertThat(obj).containsEntry("code", "code").containsEntry("message",
"msg").hasSize(2);
}
@Test