Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ public class WxCpKfEventMsg {
private String msgCode;
@SerializedName("recall_msgid")
private String recallMsgId;
@SerializedName("reject_switch")
private Integer rejectSwitch;
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ public void testKnowledgeApiRequests() throws Exception {
"{}"));
}

@Test
public void testKfMsgListRejectSwitchFromJson() {
String json = "{\"errcode\":0,\"errmsg\":\"ok\",\"msg_list\":[{\"msgid\":\"msg-1\",\"send_time\":1,\"origin\":4,\"msgtype\":\"event\",\"event\":{\"event_type\":\"reject_customer_msg_switch_change\",\"servicer_userid\":\"Zhangsan\",\"open_kfid\":\"wkAJ2GCAAASSm4_FhToWMFea0xAFfd3Q\",\"external_userid\":\"wmAJ2GCAAAme1XQRC-NI-q0_ZM9ukoAw\",\"reject_switch\":1}}]}";

WxCpKfMsgListResp response = WxCpKfMsgListResp.fromJson(json);

assertThat(response.getMsgList()).singleElement().satisfies(item -> {
assertThat(item.getEvent().getEventType()).isEqualTo("reject_customer_msg_switch_change");
assertThat(item.getEvent().getServicerUserId()).isEqualTo("Zhangsan");
assertThat(item.getEvent().getRejectSwitch()).isEqualTo(1);
});
}

private void assertJsonRequests(List<String> actual, List<String> expected) {
assertThat(actual).hasSameSizeAs(expected);
for (int i = 0; i < actual.size(); i++) {
Expand Down
Loading