🐛 修复公众号和小程序的OCR相关接口请求方式为post

This commit is contained in:
Binary Wang
2020-07-26 23:20:24 +08:00
parent fbe2dd9268
commit 6a27b838b6
3 changed files with 19 additions and 19 deletions

View File

@ -153,13 +153,13 @@ public class WxMpOcrServiceImplTest {
}
public static class MockTest {
private WxMpService wxService = mock(WxMpService.class);
private final WxMpService wxService = mock(WxMpService.class);
@Test
public void testIdCard() throws Exception {
String returnJson = "{\"type\":\"Back\",\"name\":\"张三\",\"id\":\"110101199909090099\",\"valid_date\":\"20110101-20210201\"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
when(wxService.post(anyString(), anyString())).thenReturn(returnJson);
final WxMpOcrServiceImpl wxMpOcrService = new WxMpOcrServiceImpl(wxService);
final WxOcrIdCardResult result = wxMpOcrService.idCard("abc");
@ -171,7 +171,7 @@ public class WxMpOcrServiceImplTest {
public void testBankCard() throws Exception {
String returnJson = "{\"number\":\"24234234345234\"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
when(wxService.post(anyString(), anyString())).thenReturn(returnJson);
final WxMpOcrServiceImpl wxMpOcrService = new WxMpOcrServiceImpl(wxService);
final WxOcrBankCardResult result = wxMpOcrService.bankCard("abc");
@ -246,7 +246,7 @@ public class WxMpOcrServiceImplTest {
" }\n" +
"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
when(wxService.post(anyString(), anyString())).thenReturn(returnJson);
final WxMpOcrServiceImpl wxMpOcrService = new WxMpOcrServiceImpl(wxService);
final WxOcrDrivingResult result = wxMpOcrService.driving("abc");
@ -271,7 +271,7 @@ public class WxMpOcrServiceImplTest {
" \"valid_to\": \"2020-07-01\", //有效期限终止日\n" +
" \"official_seal\": \"xx市公安局公安交通管理局\" //印章文字\n" +
"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
when(wxService.post(anyString(), anyString())).thenReturn(returnJson);
final WxMpOcrServiceImpl wxMpOcrService = new WxMpOcrServiceImpl(wxService);
final WxOcrDrivingLicenseResult result = wxMpOcrService.drivingLicense("abc");
@ -321,7 +321,7 @@ public class WxMpOcrServiceImplTest {
" \"h\": 728\n" +
" }\n" +
"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
when(wxService.post(anyString(), anyString())).thenReturn(returnJson);
final WxMpOcrServiceImpl wxMpOcrService = new WxMpOcrServiceImpl(wxService);
final WxOcrBizLicenseResult result = wxMpOcrService.bizLicense("abc");
@ -383,7 +383,7 @@ public class WxMpOcrServiceImplTest {
" \"h\": 720\n" +
" }\n" +
"}";
when(wxService.get(anyString(), anyString())).thenReturn(returnJson);
when(wxService.post(anyString(), anyString())).thenReturn(returnJson);
final WxMpOcrServiceImpl wxMpOcrService = new WxMpOcrServiceImpl(wxService);
final WxOcrCommResult result = wxMpOcrService.comm("abc");