Skip to content

Commit

Permalink
Merge pull request apache#273 from wongoo/fix-272
Browse files Browse the repository at this point in the history
add unit test for apache#272
  • Loading branch information
AlexStocks committed Aug 24, 2021
2 parents dad2892 + 82fbc49 commit 9d0f6e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ func TestString(t *testing.T) {
testDecodeFramework(t, "replyString_null", nil)
}

func TestDecodeJsonString(t *testing.T) {
jsonString := `{"params":{"fromAccid":"23495382","msgType":100,"msgId":"148ef1b2-808d-48f2-b268-7a1018a27bdb","attach":"{\"accid\":\"23495382\",\"classRoomFlag\":50685,\"msgId\":\"599645021431398400\",\"msgType\":\"100\",\"nickname\":\"橙子������\"}","roomid":413256699},"url":"https://api.netease.im/nimserver/chatroom/sendMsg.action"}`
testDecodeFramework(t, "customReplyJsonString", jsonString)
}

func TestStringEncode(t *testing.T) {
s0 := ""
s1 := "0"
Expand Down
6 changes: 6 additions & 0 deletions test_hessian/src/main/java/test/TestCustomReply.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public TestCustomReply(OutputStream os) {
typeMap.put(Date[].class, "[date");
}

public void customReplyJsonString() throws Exception {
String s = "{\"params\":{\"fromAccid\":\"23495382\",\"msgType\":100,\"msgId\":\"148ef1b2-808d-48f2-b268-7a1018a27bdb\",\"attach\":\"{\\\"accid\\\":\\\"23495382\\\",\\\"classRoomFlag\\\":50685,\\\"msgId\\\":\\\"599645021431398400\\\",\\\"msgType\\\":\\\"100\\\",\\\"nickname\\\":\\\"橙子������\\\"}\",\"roomid\":413256699},\"url\":\"https://api.netease.im/nimserver/chatroom/sendMsg.action\"}";
output.writeObject(s);
output.flush();
}

public void customReplyTypedFixedListHasNull() throws Exception {
Object[] o = new Object[]{new A0(), new A1(), null};
output.writeObject(o);
Expand Down

0 comments on commit 9d0f6e0

Please sign in to comment.