Fix CustomMessageAdapters.
This commit is contained in:
parent
aad62d7739
commit
138fadb68b
@ -24,7 +24,7 @@ final class CustomMessageAdapters {
|
||||
final Map<String, Object> params = new HashMap<String, Object>(3);
|
||||
params.put("touser", customMessage.getToUser());
|
||||
params.put("msgtype", msgType);
|
||||
params.put(msgType, customMessage.getTuple());
|
||||
params.put(msgType, tuple);
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.foxinmy.weixin4j.wxa.api;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@ -17,8 +17,9 @@ public class CustomMessageAdaptersTest {
|
||||
customMessage.setTuple(new Text("Hello World"));
|
||||
|
||||
String json = JSON.toJSONString(CustomMessageAdapters.toMap(customMessage));
|
||||
System.out.println(json);
|
||||
assertEquals("{\"touser\":\"OPENID\",\"text\":{\"content\":\"Hello World\"},\"msgtype\":\"text\"}", json);
|
||||
assertTrue(json.contains("\"touser\":\"OPENID\""));
|
||||
assertTrue(json.contains("\"msgtype\":\"text\""));
|
||||
assertTrue(json.contains("\"text\":{\"content\":\"Hello World\"}"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user