Ver a proveniência

重构测试类的包结构

master
Binary Wang há 8 anos
ascendente
cometimento
123eb5088d
21 ficheiros alterados com 62 adições e 58 eliminações
  1. +1
    -0
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpBaseAPITest.java
  2. +1
    -0
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpJsAPITest.java
  3. +9
    -9
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMassMessageAPITest.java
  4. +1
    -0
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMiscAPITest.java
  5. +1
    -0
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpShortUrlAPITest.java
  6. +1
    -1
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpCardServiceImplTest.java
  7. +1
    -1
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDataCubeServiceImplTest.java
  8. +1
    -1
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDeviceServiceImplTest.java
  9. +7
    -7
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImplTest.java
  10. +1
    -1
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMaterialServiceImplTest.java
  11. +1
    -1
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMenuServiceImplTest.java
  12. +4
    -4
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java
  13. +1
    -1
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpQrcodeServiceImplTest.java
  14. +3
    -3
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImplTest.java
  15. +1
    -1
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java
  16. +3
    -3
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpTemplateMsgServiceImplTest.java
  17. +5
    -5
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserBlacklistServiceImplTest.java
  18. +4
    -4
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserServiceImplTest.java
  19. +5
    -5
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImplTest.java
  20. +6
    -5
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/test/ApiTestModule.java
  21. +5
    -6
      weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/test/TestConfigStorage.java

+ 1
- 0
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpBaseAPITest.java Ver ficheiro

@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.api;

import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import org.apache.commons.lang3.StringUtils;
import org.testng.Assert;
import org.testng.annotations.Guice;


+ 1
- 0
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpJsAPITest.java Ver ficheiro

@@ -1,5 +1,6 @@
package me.chanjar.weixin.mp.api;

import me.chanjar.weixin.mp.api.test.ApiTestModule;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;


+ 9
- 9
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMassMessageAPITest.java Ver ficheiro

@@ -4,6 +4,8 @@ import com.google.inject.Inject;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.WxMpMassNews;
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
@@ -33,7 +35,7 @@ public class WxMpMassMessageAPITest {
@Test
public void testTextMassOpenIdsMessageSend() throws WxErrorException {
// 发送群发消息
WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configProvider = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage();
massMessage.setMsgType(WxConsts.MASS_MSG_TEXT);
@@ -47,10 +49,9 @@ public class WxMpMassMessageAPITest {
}

@Test(dataProvider = "massMessages")
public void testMediaMassOpenIdsMessageSend(String massMsgType,
String mediaId) throws WxErrorException {
public void testMediaMassOpenIdsMessageSend(String massMsgType, String mediaId) throws WxErrorException {
// 发送群发消息
WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configProvider = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
WxMpMassOpenIdsMessage massMessage = new WxMpMassOpenIdsMessage();
massMessage.setMsgType(massMsgType);
@@ -83,8 +84,7 @@ public class WxMpMassMessageAPITest {
WxMpMassTagMessage massMessage = new WxMpMassTagMessage();
massMessage.setMsgType(massMsgType);
massMessage.setMediaId(mediaId);
massMessage
.setTagId(this.wxService.getUserTagService().tagGet().get(0).getId());
massMessage.setTagId(this.wxService.getUserTagService().tagGet().get(0).getId());

WxMpMassSendResult massResult = this.wxService
.massGroupMessageSend(massMessage);
@@ -118,7 +118,7 @@ public class WxMpMassMessageAPITest {
messages[0] = new Object[]{WxConsts.MASS_MSG_VIDEO, uploadResult.getMediaId()};
}

/**
/*
* 图片素材
*/
try (InputStream inputStream = ClassLoader
@@ -130,7 +130,7 @@ public class WxMpMassMessageAPITest {
messages[1] = new Object[]{WxConsts.MASS_MSG_IMAGE, uploadMediaRes.getMediaId()};
}

/**
/*
* 语音素材
*/
try (InputStream inputStream = ClassLoader
@@ -142,7 +142,7 @@ public class WxMpMassMessageAPITest {
messages[2] = new Object[]{WxConsts.MASS_MSG_VOICE, uploadMediaRes.getMediaId()};
}

/**
/*
* 图文素材
*/
try (InputStream inputStream = ClassLoader


+ 1
- 0
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMiscAPITest.java Ver ficheiro

@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.api;

import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;


+ 1
- 0
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpShortUrlAPITest.java Ver ficheiro

@@ -2,6 +2,7 @@ package me.chanjar.weixin.mp.api;

import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;


+ 1
- 1
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpCardServiceImplTest.java Ver ficheiro

@@ -2,7 +2,7 @@ package me.chanjar.weixin.mp.api.impl;

import com.google.inject.Inject;
import me.chanjar.weixin.common.bean.WxCardApiSignature;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
import org.testng.annotations.Guice;


+ 1
- 1
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDataCubeServiceImplTest.java Ver ficheiro

@@ -14,7 +14,7 @@ import org.testng.annotations.Test;
import com.google.inject.Inject;

import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeInterfaceResult;


+ 1
- 1
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpDeviceServiceImplTest.java Ver ficheiro

@@ -3,7 +3,7 @@ package me.chanjar.weixin.mp.api.impl;

import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.device.WxDeviceQrCodeResult;
import org.testng.annotations.DataProvider;


+ 7
- 7
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImplTest.java Ver ficheiro

@@ -3,9 +3,9 @@ package me.chanjar.weixin.mp.api.impl;
import com.google.inject.Inject;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
import me.chanjar.weixin.mp.bean.kefu.result.*;
@@ -31,7 +31,7 @@ public class WxMpKefuServiceImplTest {
protected WxMpService wxService;

public void testSendKefuMpNewsMessage() throws WxErrorException {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
WxMpKefuMessage message = new WxMpKefuMessage();
message.setMsgType(WxConsts.CUSTOM_MSG_MPNEWS);
@@ -42,7 +42,7 @@ public class WxMpKefuServiceImplTest {
}

public void testSendKefuMessage() throws WxErrorException {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
WxMpKefuMessage message = new WxMpKefuMessage();
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
@@ -54,7 +54,7 @@ public class WxMpKefuServiceImplTest {
}

public void testSendKefuMessageWithKfAccount() throws WxErrorException {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
WxMpKefuMessage message = new WxMpKefuMessage();
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
@@ -85,7 +85,7 @@ public class WxMpKefuServiceImplTest {

@DataProvider
public Object[][] getKfAccount() {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
return new Object[][] { { configStorage.getKfAccount() } };
}
@@ -131,7 +131,7 @@ public class WxMpKefuServiceImplTest {

@DataProvider
public Object[][] getKfAccountAndOpenid() {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
return new Object[][] {
{ configStorage.getKfAccount(), configStorage.getOpenid() } };


+ 1
- 1
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMaterialServiceImplTest.java Ver ficheiro

@@ -5,7 +5,7 @@ import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.fs.FileUtils;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.material.WxMpMaterial;
import me.chanjar.weixin.mp.bean.material.WxMpMaterialArticleUpdate;


+ 1
- 1
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMenuServiceImplTest.java Ver ficheiro

@@ -5,7 +5,7 @@ import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.bean.menu.WxMenu;
import me.chanjar.weixin.common.bean.menu.WxMenuButton;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.menu.WxMpGetSelfMenuInfoResult;
import me.chanjar.weixin.mp.bean.menu.WxMpMenu;


+ 4
- 4
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java Ver ficheiro

@@ -3,9 +3,9 @@ package me.chanjar.weixin.mp.api.impl;
import com.github.binarywang.utils.qrcode.QrcodeUtils;
import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.pay.request.*;
import me.chanjar.weixin.mp.bean.pay.result.*;
import org.testng.annotations.*;
@@ -59,7 +59,7 @@ public class WxMpPayServiceImplTest {
*/
@Test
public void setSSLKey(){
WxXmlMpInMemoryConfigStorage config = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage();
TestConfigStorage config = (TestConfigStorage) this.wxService.getWxMpConfigStorage();
config.setSslContextFilePath(config.getKeyPath());
}

@@ -107,7 +107,7 @@ public class WxMpPayServiceImplTest {
request.setClientIp("aaa");
request.setMchBillNo("aaaa");
request
.setReOpenid(((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid());
.setReOpenid(((TestConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid());
WxPaySendRedpackResult redpackResult = this.wxService.getPayService().sendRedpack(request);
System.err.println(redpackResult);
}


+ 1
- 1
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpQrcodeServiceImplTest.java Ver ficheiro

@@ -2,7 +2,7 @@ package me.chanjar.weixin.mp.api.impl;

import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
import org.testng.Assert;


+ 3
- 3
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImplTest.java Ver ficheiro

@@ -2,9 +2,9 @@ package me.chanjar.weixin.mp.api.impl;

import com.google.inject.Inject;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
@@ -103,7 +103,7 @@ public class WxMpServiceImplTest {

@Test
public void testBuildQrConnectUrl() {
String qrconnectRedirectUrl = ((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getQrconnectRedirectUrl();
String qrconnectRedirectUrl = ((TestConfigStorage) this.wxService.getWxMpConfigStorage()).getQrconnectRedirectUrl();
String qrConnectUrl = this.wxService.buildQrConnectUrl(qrconnectRedirectUrl,
WxConsts.QRCONNECT_SCOPE_SNSAPI_LOGIN, null);
Assert.assertNotNull(qrConnectUrl);


+ 1
- 1
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java Ver ficheiro

@@ -2,7 +2,7 @@ package me.chanjar.weixin.mp.api.impl;

import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo;
import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo;


+ 3
- 3
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpTemplateMsgServiceImplTest.java Ver ficheiro

@@ -2,9 +2,9 @@ package me.chanjar.weixin.mp.api.impl;

import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateIndustry;
@@ -33,7 +33,7 @@ public class WxMpTemplateMsgServiceImplTest {
public void testSendTemplateMsg() throws WxErrorException {
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss.SSS");
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(configStorage.getOpenid())


+ 5
- 5
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserBlacklistServiceImplTest.java Ver ficheiro

@@ -1,8 +1,8 @@
package me.chanjar.weixin.mp.api.impl;

import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult;
import org.testng.Assert;
import org.testng.annotations.Guice;
@@ -23,7 +23,7 @@ public class WxMpUserBlacklistServiceImplTest {

@Test
public void testGetBlacklist() throws Exception {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
WxMpUserBlacklistGetResult wxMpUserBlacklistGetResult = this.wxService.getBlackListService().getBlacklist(configStorage.getOpenid());
Assert.assertNotNull(wxMpUserBlacklistGetResult);
@@ -35,7 +35,7 @@ public class WxMpUserBlacklistServiceImplTest {

@Test
public void testPushToBlacklist() throws Exception {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
List<String> openidList = new ArrayList<>();
openidList.add(configStorage.getOpenid());
@@ -44,7 +44,7 @@ public class WxMpUserBlacklistServiceImplTest {

@Test
public void testPullFromBlacklist() throws Exception {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
TestConfigStorage configStorage = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
List<String> openidList = new ArrayList<>();
openidList.add(configStorage.getOpenid());


+ 4
- 4
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserServiceImplTest.java Ver ficheiro

@@ -13,8 +13,8 @@ import org.testng.annotations.Test;
import com.google.inject.Inject;

import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.WxMpUserQuery;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import me.chanjar.weixin.mp.bean.result.WxMpUserList;
@@ -32,11 +32,11 @@ public class WxMpUserServiceImplTest {
@Inject
private WxMpService wxService;

private WxXmlMpInMemoryConfigStorage configProvider;
private TestConfigStorage configProvider;

@BeforeTest
public void setup() {
this.configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService
this.configProvider = (TestConfigStorage) this.wxService
.getWxMpConfigStorage();
}



+ 5
- 5
weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImplTest.java Ver ficheiro

@@ -9,8 +9,8 @@ import org.testng.annotations.Test;

import com.google.inject.Inject;

import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
import me.chanjar.weixin.mp.bean.tag.WxUserTag;

@@ -67,7 +67,7 @@ public class WxMpUserTagServiceImplTest {

@Test
public void testBatchTagging() throws Exception {
String[] openids = new String[]{((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()};
String[] openids = new String[]{((TestConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()};
boolean res = this.wxService.getUserTagService().batchTagging(this.tagId, openids);
System.out.println(res);
Assert.assertTrue(res);
@@ -75,7 +75,7 @@ public class WxMpUserTagServiceImplTest {

@Test
public void testBatchUntagging() throws Exception {
String[] openids = new String[]{((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()};
String[] openids = new String[]{((TestConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()};
boolean res = this.wxService.getUserTagService().batchUntagging(this.tagId, openids);
System.out.println(res);
Assert.assertTrue(res);
@@ -84,7 +84,7 @@ public class WxMpUserTagServiceImplTest {
@Test
public void testUserTagList() throws Exception {
List<Long> res = this.wxService.getUserTagService().userTagList(
((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid());
((TestConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid());
System.out.println(res);
Assert.assertNotNull(res);
}


weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/ApiTestModule.java → weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/test/ApiTestModule.java Ver ficheiro

@@ -1,9 +1,11 @@
package me.chanjar.weixin.mp.api;
package me.chanjar.weixin.mp.api.test;

import com.google.inject.Binder;
import com.google.inject.Module;
import com.thoughtworks.xstream.XStream;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;

import java.io.IOException;
@@ -14,10 +16,9 @@ public class ApiTestModule implements Module {

@Override
public void configure(Binder binder) {
try (InputStream is1 = ClassLoader
.getSystemResourceAsStream("test-config.xml")) {
WxXmlMpInMemoryConfigStorage config = this
.fromXml(WxXmlMpInMemoryConfigStorage.class, is1);
try (InputStream is1 = ClassLoader.getSystemResourceAsStream("test-config.xml")) {
TestConfigStorage config = this
.fromXml(TestConfigStorage.class, is1);
config.setAccessTokenLock(new ReentrantLock());
WxMpService wxService = new WxMpServiceImpl();
wxService.setWxMpConfigStorage(config);

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxXmlMpInMemoryConfigStorage.java → weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/test/TestConfigStorage.java Ver ficheiro

@@ -1,18 +1,19 @@
package me.chanjar.weixin.mp.api;
package me.chanjar.weixin.mp.api.test;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.concurrent.locks.Lock;

@XStreamAlias("xml")
public class WxXmlMpInMemoryConfigStorage
extends WxMpInMemoryConfigStorage {
public class TestConfigStorage extends WxMpInMemoryConfigStorage {

private String openid;
private String kfAccount;
private String qrconnectRedirectUrl;
private String templateId;
private String keyPath;

public String getKeyPath() {
return keyPath;
@@ -22,8 +23,6 @@ public class WxXmlMpInMemoryConfigStorage
this.keyPath = keyPath;
}

private String keyPath;

public String getOpenid() {
return this.openid;
}
@@ -61,7 +60,7 @@ public class WxXmlMpInMemoryConfigStorage
this.templateId = templateId;
}

public void setAccessTokenLock(Lock lock){
public void setAccessTokenLock(Lock lock) {
super.accessTokenLock = lock;
}


Carregando…
Cancelar
Guardar