1
1
package me .chanjar .weixin .channel .api .impl ;
2
2
3
+ import com .fasterxml .jackson .core .JsonProcessingException ;
4
+ import com .fasterxml .jackson .databind .ObjectMapper ;
3
5
import com .google .inject .Inject ;
4
6
import me .chanjar .weixin .channel .api .WxChannelService ;
5
7
import me .chanjar .weixin .channel .bean .lead .component .request .GetLeadInfoByComponentRequest ;
28
30
@ Guice (modules = ApiTestModule .class )
29
31
public class WxLeadComponentServiceImplTest {
30
32
33
+ private static final String LEADS_COMPONENT_ID = "123" ;
34
+ private static final String REQUEST_ID = "123" ;
35
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper ();
31
36
@ Inject
32
37
private WxChannelService channelService ;
33
38
34
39
@ Test
35
- public void testGetLeadsInfoByComponentId () throws WxErrorException {
40
+ public void testGetLeadsInfoByComponentId () throws WxErrorException , JsonProcessingException {
36
41
String lastBuffer = null ;
37
42
for (; ; ) {
38
43
GetLeadInfoByComponentRequest req = new GetLeadInfoByComponentRequest ();
39
44
req .setStartTime (Instant .now ().minus (1 , ChronoUnit .DAYS ).getEpochSecond ());
40
45
req .setEndTime (Instant .now ().getEpochSecond ());
41
- req .setLeadsComponentId ("123" );
46
+ req .setLeadsComponentId (LEADS_COMPONENT_ID );
42
47
req .setLastBuffer (lastBuffer );
48
+ req .setVersion (1 );
43
49
LeadInfoResponse response = channelService .getLeadComponentService ().getLeadsInfoByComponentId (req );
50
+ System .out .println (OBJECT_MAPPER .writeValueAsString (response ));
44
51
assertNotNull (response );
45
52
assertTrue (response .isSuccess ());
46
53
lastBuffer = response .getLastBuffer ();
@@ -51,13 +58,14 @@ public void testGetLeadsInfoByComponentId() throws WxErrorException {
51
58
}
52
59
53
60
@ Test
54
- public void testGetLeadsInfoByRequestId () throws WxErrorException {
61
+ public void testGetLeadsInfoByRequestId () throws WxErrorException , JsonProcessingException {
55
62
String lastBuffer = null ;
56
63
for (; ; ) {
57
64
GetLeadsInfoByRequestIdRequest req = new GetLeadsInfoByRequestIdRequest ();
58
65
req .setLastBuffer (lastBuffer );
59
- req .setRequestId ("123" );
66
+ req .setRequestId (REQUEST_ID );
60
67
LeadInfoResponse response = channelService .getLeadComponentService ().getLeadsInfoByRequestId (req );
68
+ System .out .println (OBJECT_MAPPER .writeValueAsString (response ));
61
69
assertNotNull (response );
62
70
assertTrue (response .isSuccess ());
63
71
lastBuffer = response .getLastBuffer ();
@@ -68,13 +76,14 @@ public void testGetLeadsInfoByRequestId() throws WxErrorException {
68
76
}
69
77
70
78
@ Test
71
- public void testGetLeadsRequestId () throws WxErrorException {
79
+ public void testGetLeadsRequestId () throws WxErrorException , JsonProcessingException {
72
80
String lastBuffer = null ;
73
81
for (; ; ) {
74
82
GetLeadsRequestIdRequest req = new GetLeadsRequestIdRequest ();
75
83
req .setLastBuffer (lastBuffer );
76
- req .setLeadsComponentId ("123" );
84
+ req .setLeadsComponentId (LEADS_COMPONENT_ID );
77
85
GetLeadsRequestIdResponse response = channelService .getLeadComponentService ().getLeadsRequestId (req );
86
+ System .out .println (OBJECT_MAPPER .writeValueAsString (response ));
78
87
assertNotNull (response );
79
88
assertTrue (response .isSuccess ());
80
89
lastBuffer = response .getLastBuffer ();
@@ -85,15 +94,16 @@ public void testGetLeadsRequestId() throws WxErrorException {
85
94
}
86
95
87
96
@ Test
88
- public void testGetLeadsComponentPromoteRecord () throws WxErrorException {
97
+ public void testGetLeadsComponentPromoteRecord () throws WxErrorException , JsonProcessingException {
89
98
String lastBuffer = null ;
90
99
for (; ; ) {
91
100
GetLeadsComponentPromoteRecordRequest req = new GetLeadsComponentPromoteRecordRequest ();
92
101
req .setStartTime (Instant .now ().minus (1 , ChronoUnit .DAYS ).getEpochSecond ());
93
102
req .setEndTime (Instant .now ().getEpochSecond ());
94
- req .setLeadsComponentId ("123" );
103
+ req .setLeadsComponentId (LEADS_COMPONENT_ID );
95
104
req .setLastBuffer (lastBuffer );
96
105
GetLeadsComponentPromoteRecordResponse response = channelService .getLeadComponentService ().getLeadsComponentPromoteRecord (req );
106
+ System .out .println (OBJECT_MAPPER .writeValueAsString (response ));
97
107
assertNotNull (response );
98
108
assertTrue (response .isSuccess ());
99
109
lastBuffer = response .getLastBuffer ();
@@ -104,13 +114,13 @@ public void testGetLeadsComponentPromoteRecord() throws WxErrorException {
104
114
}
105
115
106
116
@ Test
107
- public void testGetLeadsComponentId () throws WxErrorException {
117
+ public void testGetLeadsComponentId () throws WxErrorException , JsonProcessingException {
108
118
String lastBuffer = null ;
109
119
for (; ; ) {
110
120
GetLeadsComponentIdRequest req = new GetLeadsComponentIdRequest ();
111
121
req .setLastBuffer (lastBuffer );
112
122
GetLeadsComponentIdResponse response = channelService .getLeadComponentService ().getLeadsComponentId (req );
113
- System .out .println (response );
123
+ System .out .println (OBJECT_MAPPER . writeValueAsString ( response ) );
114
124
assertNotNull (response );
115
125
assertTrue (response .isSuccess ());
116
126
lastBuffer = response .getLastBuffer ();
0 commit comments