1
0
mirror of synced 2025-12-21 16:38:01 +08:00

#857 添加微信小程序敏感文本检测接口

This commit is contained in:
Binary Wang
2018-11-24 20:34:42 +08:00
parent a73d6e69aa
commit 7cb92a85f6
6 changed files with 164 additions and 39 deletions

View File

@@ -0,0 +1,51 @@
package cn.binarywang.wx.miniapp.api.impl;
import java.io.File;
import org.testng.annotations.*;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.test.ApiTestModule;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.*;
/**
* <pre>
*
* Created by Binary Wang on 2018/11/24.
* </pre>
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
@Test
@Guice(modules = ApiTestModule.class)
public class WxMaSecCheckServiceImplTest {
@Inject
private WxMaService wxService;
@Test
public void testCheckImage() throws WxErrorException {
boolean result = this.wxService.getSecCheckService()
.checkImage(new File(ClassLoader.getSystemResource("tmp.png").getFile()));
assertTrue(result);
}
@DataProvider
public Object[][] secData() {
return new Object[][]{
{"特3456书yuuo莞6543李zxcz蒜7782法fgnv级", false},
{"完2347全dfji试3726测asad感3847知qwez到", false},
{"hello world!", true}
};
}
@Test(dataProvider = "secData")
public void testCheckMessage(String msg, boolean result) {
assertThat(this.wxService.getSecCheckService()
.checkMessage(msg))
.isEqualTo(result);
}
}

View File

@@ -33,9 +33,4 @@ public class WxMaServiceImplTest {
assertTrue(StringUtils.isNotBlank(after));
}
@Test
public void testImgSecCheck() throws WxErrorException {
boolean result = this.wxService.imgSecCheck(new File(ClassLoader.getSystemResource("tmp.png").getFile()));
assertTrue(result);
}
}