You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Original problematic error message from the issue
13
+
val errorMessage ="General Server error"
14
+
val errorDetails ="An unexpected error occurred during the POST request: Unable to resolve host \"socialize.us1.gigya.com\": No address associated with hostname"
15
+
val errorCode =500001
16
+
17
+
println("Creating CDCResponse with problematic error message...")
18
+
println("Error Code: $errorCode")
19
+
println("Error Message: $errorMessage")
20
+
println("Error Details: $errorDetails")
21
+
println()
22
+
23
+
// Create response using the fixed fromError method
* Tests the fix for JSON parsing errors when error messages contain special characters
10
+
* such as quotes, backslashes, and other JSON-breaking characters.
11
+
*/
13
12
classCDCResponseTest {
14
13
15
14
@Test
16
-
funtestFromJSON() {
17
-
val json ="""{"callId":"12345","errorCode":0,"errorMessage":"Success"}"""
18
-
val response =CDCResponse().fromJSON(json)
19
-
assertEquals("12345", response.callId())
20
-
assertEquals(0, response.errorCode())
21
-
assertEquals("Success", response.errorMessage())
22
-
}
15
+
fun`test fromError with special characters in error message`() {
16
+
// This is the problematic error message from the issue
17
+
val errorMessage ="General Server error"
18
+
val errorDetails ="An unexpected error occurred during the POST request: Unable to resolve host \"socialize.us1.gigya.com\": No address associated with hostname"
19
+
val errorCode =500001
23
20
24
-
@Test
25
-
funtestFromError() {
26
-
val error =CDCError(404, "Not Found", "The requested resource was not found")
0 commit comments