mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 13:06:54 +08:00
尽量使用接口引用 use interface where possible
This commit is contained in:
parent
639206ca1a
commit
1ceb4bf707
@ -18,10 +18,10 @@ public class ApiTestModule implements Module {
|
|||||||
.getSystemResourceAsStream("test-config.xml")) {
|
.getSystemResourceAsStream("test-config.xml")) {
|
||||||
WxXmlMpInMemoryConfigStorage config = this
|
WxXmlMpInMemoryConfigStorage config = this
|
||||||
.fromXml(WxXmlMpInMemoryConfigStorage.class, is1);
|
.fromXml(WxXmlMpInMemoryConfigStorage.class, is1);
|
||||||
WxMpServiceImpl wxService = new WxMpServiceImpl();
|
WxMpService wxService = new WxMpServiceImpl();
|
||||||
wxService.setWxMpConfigStorage(config);
|
wxService.setWxMpConfigStorage(config);
|
||||||
|
|
||||||
binder.bind(WxMpServiceImpl.class).toInstance(wxService);
|
binder.bind(WxMpService.class).toInstance(wxService);
|
||||||
binder.bind(WxMpConfigStorage.class).toInstance(config);
|
binder.bind(WxMpConfigStorage.class).toInstance(config);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -2,7 +2,6 @@ package me.chanjar.weixin.mp.api;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
@ -18,7 +17,7 @@ import org.testng.annotations.Test;
|
|||||||
public class WxMpBaseAPITest {
|
public class WxMpBaseAPITest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
public void testRefreshAccessToken() throws WxErrorException {
|
public void testRefreshAccessToken() throws WxErrorException {
|
||||||
WxMpConfigStorage configStorage = this.wxService.getWxMpConfigStorage();
|
WxMpConfigStorage configStorage = this.wxService.getWxMpConfigStorage();
|
||||||
|
@ -8,11 +8,10 @@ import com.google.inject.Inject;
|
|||||||
|
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.common.util.crypto.SHA1;
|
import me.chanjar.weixin.common.util.crypto.SHA1;
|
||||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试jsapi ticket接口
|
* 测试jsapi ticket接口
|
||||||
*
|
*
|
||||||
* @author chanjarster
|
* @author chanjarster
|
||||||
*/
|
*/
|
||||||
@Test(groups = "jsAPI", dependsOnGroups = "baseAPI")
|
@Test(groups = "jsAPI", dependsOnGroups = "baseAPI")
|
||||||
@ -20,7 +19,7 @@ import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
|||||||
public class WxMpJsAPITest {
|
public class WxMpJsAPITest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
|
|
||||||
public void testJsapiTicket() throws WxErrorException {
|
public void testJsapiTicket() throws WxErrorException {
|
||||||
|
@ -13,7 +13,6 @@ import com.google.inject.Inject;
|
|||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
|
||||||
import me.chanjar.weixin.mp.bean.WxMpMassNews;
|
import me.chanjar.weixin.mp.bean.WxMpMassNews;
|
||||||
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
|
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
|
||||||
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
|
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
|
||||||
@ -31,7 +30,7 @@ import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
|
|||||||
public class WxMpMassMessageAPITest {
|
public class WxMpMassMessageAPITest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTextMassOpenIdsMessageSend() throws WxErrorException {
|
public void testTextMassOpenIdsMessageSend() throws WxErrorException {
|
||||||
|
@ -2,7 +2,6 @@ package me.chanjar.weixin.mp.api;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@ -19,7 +18,7 @@ import java.util.Arrays;
|
|||||||
public class WxMpMiscAPITest {
|
public class WxMpMiscAPITest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCallbackIP() throws WxErrorException {
|
public void testGetCallbackIP() throws WxErrorException {
|
||||||
|
@ -2,14 +2,13 @@ package me.chanjar.weixin.mp.api;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试短连接
|
* 测试短连接
|
||||||
*
|
*
|
||||||
* @author chanjarster
|
* @author chanjarster
|
||||||
*/
|
*/
|
||||||
@Test(groups = "shortURLAPI")
|
@Test(groups = "shortURLAPI")
|
||||||
@ -17,7 +16,7 @@ import org.testng.annotations.Test;
|
|||||||
public class WxMpShortUrlAPITest {
|
public class WxMpShortUrlAPITest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
public void testShortUrl() throws WxErrorException {
|
public void testShortUrl() throws WxErrorException {
|
||||||
String shortUrl = this.wxService.shortUrl("www.baidu.com");
|
String shortUrl = this.wxService.shortUrl("www.baidu.com");
|
||||||
|
@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.bean.WxCardApiSignature;
|
import me.chanjar.weixin.common.bean.WxCardApiSignature;
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
|
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@ -19,7 +20,7 @@ import static org.testng.AssertJUnit.assertNotNull;
|
|||||||
public class WxMpCardServiceImplTest {
|
public class WxMpCardServiceImplTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
private String cardId = "123";
|
private String cardId = "123";
|
||||||
private String code = "good";
|
private String code = "good";
|
||||||
private String openid = "abc";
|
private String openid = "abc";
|
||||||
@ -90,4 +91,4 @@ public class WxMpCardServiceImplTest {
|
|||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.text.ParseException;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import org.apache.commons.lang3.time.FastDateFormat;
|
import org.apache.commons.lang3.time.FastDateFormat;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
@ -32,7 +33,7 @@ public class WxMpDataCubeServiceImplTest {
|
|||||||
.getInstance("yyyy-MM-dd");
|
.getInstance("yyyy-MM-dd");
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
@DataProvider
|
@DataProvider
|
||||||
public Object[][] oneDay() throws ParseException {
|
public Object[][] oneDay() throws ParseException {
|
||||||
|
@ -4,6 +4,7 @@ import com.google.inject.Inject;
|
|||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||||
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
|
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
|
||||||
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
|
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
|
||||||
@ -27,7 +28,7 @@ import java.util.Date;
|
|||||||
public class WxMpKefuServiceImplTest {
|
public class WxMpKefuServiceImplTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
public void testSendKefuMpNewsMessage() throws WxErrorException {
|
public void testSendKefuMpNewsMessage() throws WxErrorException {
|
||||||
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
|
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
|
||||||
|
@ -6,6 +6,7 @@ import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
|
|||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.common.util.fs.FileUtils;
|
import me.chanjar.weixin.common.util.fs.FileUtils;
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.bean.material.WxMpMaterial;
|
import me.chanjar.weixin.mp.bean.material.WxMpMaterial;
|
||||||
import me.chanjar.weixin.mp.bean.material.WxMpMaterialArticleUpdate;
|
import me.chanjar.weixin.mp.bean.material.WxMpMaterialArticleUpdate;
|
||||||
import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews;
|
import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews;
|
||||||
@ -32,7 +33,7 @@ import static org.junit.Assert.*;
|
|||||||
@Guice(modules = ApiTestModule.class)
|
@Guice(modules = ApiTestModule.class)
|
||||||
public class WxMpMaterialServiceImplTest {
|
public class WxMpMaterialServiceImplTest {
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
private Map<String, Map<String, Object>> mediaIds = new LinkedHashMap<>();
|
private Map<String, Map<String, Object>> mediaIds = new LinkedHashMap<>();
|
||||||
// 缩略图的id,测试上传图文使用
|
// 缩略图的id,测试上传图文使用
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.chanjar.weixin.mp.api.impl;
|
package me.chanjar.weixin.mp.api.impl;
|
||||||
|
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
@ -24,8 +25,8 @@ import me.chanjar.weixin.mp.api.ApiTestModule;
|
|||||||
public class WxMpMenuServiceImplTest {
|
public class WxMpMenuServiceImplTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
@Test(dataProvider = "menu")
|
@Test(dataProvider = "menu")
|
||||||
public void testCreateMenu(WxMenu wxMenu) throws WxErrorException {
|
public void testCreateMenu(WxMenu wxMenu) throws WxErrorException {
|
||||||
System.out.println(wxMenu.toJson());
|
System.out.println(wxMenu.toJson());
|
||||||
@ -82,12 +83,12 @@ public class WxMpMenuServiceImplTest {
|
|||||||
Assert.assertNotNull(wxMenu);
|
Assert.assertNotNull(wxMenu);
|
||||||
System.out.println(wxMenu.toJson());
|
System.out.println(wxMenu.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dependsOnMethods = { "testGetMenu"})
|
@Test(dependsOnMethods = { "testGetMenu"})
|
||||||
public void testDeleteMenu() throws WxErrorException {
|
public void testDeleteMenu() throws WxErrorException {
|
||||||
this.wxService.getMenuService().menuDelete();
|
this.wxService.getMenuService().menuDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DataProvider(name="menu")
|
@DataProvider(name="menu")
|
||||||
public Object[][] getMenu() {
|
public Object[][] getMenu() {
|
||||||
WxMenu menu = new WxMenu();
|
WxMenu menu = new WxMenu();
|
||||||
@ -95,45 +96,45 @@ public class WxMpMenuServiceImplTest {
|
|||||||
button1.setType(WxConsts.BUTTON_CLICK);
|
button1.setType(WxConsts.BUTTON_CLICK);
|
||||||
button1.setName("今日歌曲");
|
button1.setName("今日歌曲");
|
||||||
button1.setKey("V1001_TODAY_MUSIC");
|
button1.setKey("V1001_TODAY_MUSIC");
|
||||||
|
|
||||||
WxMenuButton button2 = new WxMenuButton();
|
WxMenuButton button2 = new WxMenuButton();
|
||||||
button2.setType(WxConsts.BUTTON_CLICK);
|
button2.setType(WxConsts.BUTTON_CLICK);
|
||||||
button2.setName("歌手简介");
|
button2.setName("歌手简介");
|
||||||
button2.setKey("V1001_TODAY_SINGER");
|
button2.setKey("V1001_TODAY_SINGER");
|
||||||
|
|
||||||
WxMenuButton button3 = new WxMenuButton();
|
WxMenuButton button3 = new WxMenuButton();
|
||||||
button3.setName("菜单");
|
button3.setName("菜单");
|
||||||
|
|
||||||
menu.getButtons().add(button1);
|
menu.getButtons().add(button1);
|
||||||
menu.getButtons().add(button2);
|
menu.getButtons().add(button2);
|
||||||
menu.getButtons().add(button3);
|
menu.getButtons().add(button3);
|
||||||
|
|
||||||
WxMenuButton button31 = new WxMenuButton();
|
WxMenuButton button31 = new WxMenuButton();
|
||||||
button31.setType(WxConsts.BUTTON_VIEW);
|
button31.setType(WxConsts.BUTTON_VIEW);
|
||||||
button31.setName("搜索");
|
button31.setName("搜索");
|
||||||
button31.setUrl("http://www.soso.com/");
|
button31.setUrl("http://www.soso.com/");
|
||||||
|
|
||||||
WxMenuButton button32 = new WxMenuButton();
|
WxMenuButton button32 = new WxMenuButton();
|
||||||
button32.setType(WxConsts.BUTTON_VIEW);
|
button32.setType(WxConsts.BUTTON_VIEW);
|
||||||
button32.setName("视频");
|
button32.setName("视频");
|
||||||
button32.setUrl("http://v.qq.com/");
|
button32.setUrl("http://v.qq.com/");
|
||||||
|
|
||||||
WxMenuButton button33 = new WxMenuButton();
|
WxMenuButton button33 = new WxMenuButton();
|
||||||
button33.setType(WxConsts.BUTTON_CLICK);
|
button33.setType(WxConsts.BUTTON_CLICK);
|
||||||
button33.setName("赞一下我们");
|
button33.setName("赞一下我们");
|
||||||
button33.setKey("V1001_GOOD");
|
button33.setKey("V1001_GOOD");
|
||||||
|
|
||||||
button3.getSubButtons().add(button31);
|
button3.getSubButtons().add(button31);
|
||||||
button3.getSubButtons().add(button32);
|
button3.getSubButtons().add(button32);
|
||||||
button3.getSubButtons().add(button33);
|
button3.getSubButtons().add(button33);
|
||||||
|
|
||||||
return new Object[][] {
|
return new Object[][] {
|
||||||
new Object[] {
|
new Object[] {
|
||||||
menu
|
menu
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||||
import me.chanjar.weixin.mp.bean.pay.request.WxEntPayRequest;
|
import me.chanjar.weixin.mp.bean.pay.request.WxEntPayRequest;
|
||||||
import me.chanjar.weixin.mp.bean.pay.request.WxPayRefundRequest;
|
import me.chanjar.weixin.mp.bean.pay.request.WxPayRefundRequest;
|
||||||
@ -26,7 +27,7 @@ import java.io.File;
|
|||||||
public class WxMpPayServiceImplTest {
|
public class WxMpPayServiceImplTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetPayInfo() throws Exception {
|
public void testGetPayInfo() throws Exception {
|
||||||
@ -65,7 +66,6 @@ public class WxMpPayServiceImplTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#unifiedOrder(WxPayUnifiedOrderRequest)}.
|
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#unifiedOrder(WxPayUnifiedOrderRequest)}.
|
||||||
* @throws WxErrorException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUnifiedOrder() throws WxErrorException {
|
public void testUnifiedOrder() throws WxErrorException {
|
||||||
@ -78,7 +78,6 @@ public class WxMpPayServiceImplTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#queryOrder(String, String)} .
|
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#queryOrder(String, String)} .
|
||||||
* @throws WxErrorException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public final void testQueryOrder() throws WxErrorException {
|
public final void testQueryOrder() throws WxErrorException {
|
||||||
@ -89,7 +88,6 @@ public class WxMpPayServiceImplTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#closeOrder(String)} .
|
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#closeOrder(String)} .
|
||||||
* @throws WxErrorException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public final void testCloseOrder() throws WxErrorException {
|
public final void testCloseOrder() throws WxErrorException {
|
||||||
@ -98,7 +96,6 @@ public class WxMpPayServiceImplTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#entPay(WxEntPayRequest, File)}.
|
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#entPay(WxEntPayRequest, File)}.
|
||||||
* @throws WxErrorException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public final void testEntPay() throws WxErrorException {
|
public final void testEntPay() throws WxErrorException {
|
||||||
@ -109,7 +106,6 @@ public class WxMpPayServiceImplTest {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#queryEntPay(String, File)}.
|
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#queryEntPay(String, File)}.
|
||||||
* @throws WxErrorException
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public final void testQueryEntPay() throws WxErrorException {
|
public final void testQueryEntPay() throws WxErrorException {
|
||||||
|
@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
@ -12,7 +13,7 @@ import java.io.File;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试用户相关的接口
|
* 测试用户相关的接口
|
||||||
*
|
*
|
||||||
* @author chanjarster
|
* @author chanjarster
|
||||||
*/
|
*/
|
||||||
@Test(groups = "qrCodeAPI")
|
@Test(groups = "qrCodeAPI")
|
||||||
@ -20,7 +21,7 @@ import java.io.File;
|
|||||||
public class WxMpQrCodeServiceImplTest {
|
public class WxMpQrCodeServiceImplTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
public void testQrCodeCreateTmpTicket() throws WxErrorException {
|
public void testQrCodeCreateTmpTicket() throws WxErrorException {
|
||||||
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateTmpTicket(1, null);
|
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateTmpTicket(1, null);
|
||||||
@ -44,7 +45,7 @@ public class WxMpQrCodeServiceImplTest {
|
|||||||
Assert.assertNotNull(file);
|
Assert.assertNotNull(file);
|
||||||
System.out.println(file.getAbsolutePath());
|
System.out.println(file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testQrCodePictureUrl() throws WxErrorException {
|
public void testQrCodePictureUrl() throws WxErrorException {
|
||||||
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateLastTicket(1);
|
WxMpQrCodeTicket ticket = this.wxService.getQrcodeService().qrCodeCreateLastTicket(1);
|
||||||
String url = this.wxService.getQrcodeService().qrCodePictureUrl(ticket.getTicket());
|
String url = this.wxService.getQrcodeService().qrCodePictureUrl(ticket.getTicket());
|
||||||
|
@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
@ -13,7 +14,7 @@ import org.testng.annotations.Test;
|
|||||||
public class WxMpServiceImplTest {
|
public class WxMpServiceImplTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private WxMpServiceImpl wxService;
|
private WxMpService wxService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCheckSignature() {
|
public void testCheckSignature() {
|
||||||
|
@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo;
|
import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo;
|
||||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo;
|
import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo;
|
||||||
import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult;
|
import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult;
|
||||||
@ -23,7 +24,7 @@ import static org.junit.Assert.assertNotNull;
|
|||||||
@Guice(modules = ApiTestModule.class)
|
@Guice(modules = ApiTestModule.class)
|
||||||
public class WxMpStoreServiceImplTest {
|
public class WxMpStoreServiceImplTest {
|
||||||
@Inject
|
@Inject
|
||||||
private WxMpServiceImpl wxMpService;
|
private WxMpService wxMpService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpStoreServiceImpl#add(me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo)}.
|
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpStoreServiceImpl#add(me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo)}.
|
||||||
|
@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api.impl;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||||
import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
|
import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
|
||||||
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
|
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
|
||||||
@ -25,7 +26,7 @@ import java.util.List;
|
|||||||
@Guice(modules = ApiTestModule.class)
|
@Guice(modules = ApiTestModule.class)
|
||||||
public class WxMpTemplateMsgServiceImplTest {
|
public class WxMpTemplateMsgServiceImplTest {
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
@Test(invocationCount = 10, threadPoolSize = 10)
|
@Test(invocationCount = 10, threadPoolSize = 10)
|
||||||
public void testSendTemplateMsg() throws WxErrorException {
|
public void testSendTemplateMsg() throws WxErrorException {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.chanjar.weixin.mp.api.impl;
|
package me.chanjar.weixin.mp.api.impl;
|
||||||
|
|
||||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||||
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult;
|
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
@ -18,7 +19,7 @@ import java.util.List;
|
|||||||
@Guice(modules = ApiTestModule.class)
|
@Guice(modules = ApiTestModule.class)
|
||||||
public class WxMpUserBlacklistServiceImplTest {
|
public class WxMpUserBlacklistServiceImplTest {
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetBlacklist() throws Exception {
|
public void testGetBlacklist() throws Exception {
|
||||||
|
@ -4,6 +4,7 @@ package me.chanjar.weixin.mp.api.impl;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.BeforeTest;
|
import org.testng.annotations.BeforeTest;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
@ -29,7 +30,7 @@ import me.chanjar.weixin.mp.bean.result.WxMpUserList;
|
|||||||
public class WxMpUserServiceImplTest {
|
public class WxMpUserServiceImplTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private WxMpServiceImpl wxService;
|
private WxMpService wxService;
|
||||||
|
|
||||||
private WxXmlMpInMemoryConfigStorage configProvider;
|
private WxXmlMpInMemoryConfigStorage configProvider;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.api.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Guice;
|
import org.testng.annotations.Guice;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
@ -22,7 +23,7 @@ import me.chanjar.weixin.mp.bean.tag.WxUserTag;
|
|||||||
@Guice(modules = ApiTestModule.class)
|
@Guice(modules = ApiTestModule.class)
|
||||||
public class WxMpUserTagServiceImplTest {
|
public class WxMpUserTagServiceImplTest {
|
||||||
@Inject
|
@Inject
|
||||||
protected WxMpServiceImpl wxService;
|
protected WxMpService wxService;
|
||||||
|
|
||||||
private Long tagId = 2L;
|
private Long tagId = 2L;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user