1
1
package cn .binarywang .wx .miniapp .api .impl ;
2
2
3
- import java .io .File ;
4
-
3
+ import cn .binarywang .wx .miniapp .api .WxMaService ;
4
+ import cn .binarywang .wx .miniapp .bean .safety .request .WxMaUserSafetyRiskRankRequest ;
5
+ import cn .binarywang .wx .miniapp .bean .safety .response .WxMaUserSafetyRiskRankResponse ;
5
6
import cn .binarywang .wx .miniapp .bean .security .WxMaMsgSecCheckCheckRequest ;
6
7
import cn .binarywang .wx .miniapp .bean .security .WxMaMsgSecCheckCheckResponse ;
7
- import org .testng .annotations .*;
8
-
9
- import cn .binarywang .wx .miniapp .api .WxMaService ;
10
8
import cn .binarywang .wx .miniapp .test .ApiTestModule ;
11
9
import com .google .inject .Inject ;
12
10
import me .chanjar .weixin .common .error .WxErrorException ;
11
+ import org .testng .annotations .DataProvider ;
12
+ import org .testng .annotations .Guice ;
13
+ import org .testng .annotations .Test ;
14
+
15
+ import java .io .File ;
13
16
14
17
import static org .assertj .core .api .Assertions .assertThat ;
15
- import static org .testng .Assert .*;
18
+ import static org .testng .Assert .assertTrue ;
19
+ import static org .testng .AssertJUnit .assertNotNull ;
16
20
17
21
/**
18
22
* <pre>
24
28
*/
25
29
@ Test
26
30
@ Guice (modules = ApiTestModule .class )
27
- public class WxMaSecCheckServiceImplTest {
31
+ public class WxMaSecurityServiceImplTest {
28
32
@ Inject
29
33
private WxMaService wxService ;
30
34
31
35
@ Test
32
36
public void testCheckImage () throws WxErrorException {
33
- boolean result = this .wxService .getSecCheckService ()
37
+ boolean result = this .wxService .getSecurityService ()
34
38
.checkImage (new File (ClassLoader .getSystemResource ("tmp.png" ).getFile ()));
35
39
assertTrue (result );
36
40
}
@@ -47,7 +51,7 @@ public Object[][] secData() {
47
51
48
52
@ Test (dataProvider = "secData" )
49
53
public void testCheckMessage (String msg , boolean result ) throws WxErrorException {
50
- assertThat (this .wxService .getSecCheckService ()
54
+ assertThat (this .wxService .getSecurityService ()
51
55
.checkMessage (msg ))
52
56
.isEqualTo (result );
53
57
}
@@ -60,7 +64,19 @@ public void testCheckMessage2(String msg, boolean result) throws WxErrorExceptio
60
64
.version ("2" )
61
65
.openid ("xxx" )
62
66
.build ();
63
- WxMaMsgSecCheckCheckResponse response = this .wxService .getSecCheckService ().checkMessage (request );
67
+ WxMaMsgSecCheckCheckResponse response = this .wxService .getSecurityService ().checkMessage (request );
64
68
assertThat (response ).isNotNull ();
65
69
}
70
+
71
+ @ Test
72
+ public void testGetUserRiskRank () throws WxErrorException {
73
+ WxMaUserSafetyRiskRankRequest wxMaUserSafetyRiskRankRequest = WxMaUserSafetyRiskRankRequest .builder ()
74
+ .appid ("" )
75
+ .openid ("" )
76
+ .scene (1 )
77
+ .isTest (true )
78
+ .build ();
79
+ WxMaUserSafetyRiskRankResponse wxMaUserSafetyRiskRankResponse = this .wxService .getSecurityService ().getUserRiskRank (wxMaUserSafetyRiskRankRequest );
80
+ assertNotNull (wxMaUserSafetyRiskRankResponse );
81
+ }
66
82
}
0 commit comments