Skip to content

Commit 58b871b

Browse files
committed
Fix flaky should_include_code_in_json_when_code_is_not_null
1 parent 842c55e commit 58b871b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ void should_not_include_code_in_json_when_code_is_null() {
3636
void should_include_code_in_json_when_code_is_not_null() {
3737
CommonExceptionData data = new CommonExceptionData("code", "msg");
3838

39-
assertThat(Json.encode(data)).isEqualTo("{\"code\":\"code\",\"message\":\"msg\"}");
39+
String json = Json.encode(data);
40+
@SuppressWarnings("unchecked")
41+
Map<String, Object> obj = Json.decodeValue(json, Map.class);
42+
43+
assertThat(obj).containsEntry("code", "code").containsEntry("message", "msg").hasSize(2);
4044
}
4145

4246
@Test

0 commit comments

Comments
 (0)