mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
添加对发送模板消息的单元测试
This commit is contained in:
@@ -7,9 +7,6 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class WxMpTemplateData implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6301835292940277870L;
|
||||
private String name;
|
||||
private String value;
|
||||
@@ -48,6 +45,7 @@ public class WxMpTemplateData implements Serializable {
|
||||
public String getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
package me.chanjar.weixin.mp.bean;
|
||||
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WxMpTemplateMessage implements Serializable {
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class WxMpTemplateMessage implements Serializable {
|
||||
private static final long serialVersionUID = 5063374783759519418L;
|
||||
|
||||
private String toUser;
|
||||
private String templateId;
|
||||
private String url;
|
||||
@@ -65,4 +62,61 @@ public class WxMpTemplateMessage implements Serializable {
|
||||
public String toJson() {
|
||||
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
|
||||
}
|
||||
|
||||
public static WxMpTemplateMessageBuilder builder() {
|
||||
return new WxMpTemplateMessageBuilder();
|
||||
}
|
||||
|
||||
public static class WxMpTemplateMessageBuilder {
|
||||
private String toUser;
|
||||
private String templateId;
|
||||
private String url;
|
||||
private String topColor;
|
||||
private List<WxMpTemplateData> data = new ArrayList<>();
|
||||
|
||||
public WxMpTemplateMessageBuilder toUser(String toUser) {
|
||||
this.toUser = toUser;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxMpTemplateMessageBuilder templateId(String templateId) {
|
||||
this.templateId = templateId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxMpTemplateMessageBuilder url(String url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxMpTemplateMessageBuilder topColor(String topColor) {
|
||||
this.topColor = topColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxMpTemplateMessageBuilder data(List<WxMpTemplateData> data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxMpTemplateMessageBuilder from(WxMpTemplateMessage origin) {
|
||||
this.toUser(origin.toUser);
|
||||
this.templateId(origin.templateId);
|
||||
this.url(origin.url);
|
||||
this.topColor(origin.topColor);
|
||||
this.data(origin.data);
|
||||
return this;
|
||||
}
|
||||
|
||||
public WxMpTemplateMessage build() {
|
||||
WxMpTemplateMessage m = new WxMpTemplateMessage();
|
||||
m.toUser = this.toUser;
|
||||
m.templateId = this.templateId;
|
||||
m.url = this.url;
|
||||
m.topColor = this.topColor;
|
||||
m.data = this.data;
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user