使用IDEA统一格式化测试代码

This commit is contained in:
Binary Wang
2017-01-23 16:54:48 +08:00
parent 123eb5088d
commit ff1b69a38f
45 changed files with 591 additions and 642 deletions

View File

@@ -4,14 +4,13 @@ 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.test.ApiTestModule; import me.chanjar.weixin.mp.api.test.ApiTestModule;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Guice; import org.testng.annotations.*;
import org.testng.annotations.Test;
/** /**
* 基础API测试 * 基础API测试
* @author chanjarster
* *
* @author chanjarster
*/ */
@Test(groups = "baseAPI") @Test(groups = "baseAPI")
@Guice(modules = ApiTestModule.class) @Guice(modules = ApiTestModule.class)

View File

@@ -4,8 +4,7 @@ import me.chanjar.weixin.common.bean.result.WxError;
import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestExecutor; import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import org.testng.annotations.DataProvider; import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;

View File

@@ -1,14 +1,11 @@
package me.chanjar.weixin.mp.api; 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;
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.common.util.crypto.SHA1; import me.chanjar.weixin.common.util.crypto.SHA1;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import org.testng.*;
import org.testng.annotations.*;
/** /**
* 测试jsapi ticket接口 * 测试jsapi ticket接口

View File

@@ -12,10 +12,8 @@ import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
import me.chanjar.weixin.mp.bean.WxMpMassVideo; import me.chanjar.weixin.mp.bean.WxMpMassVideo;
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult; import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult; import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.DataProvider; import org.testng.annotations.*;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

View File

@@ -5,16 +5,15 @@ import me.chanjar.weixin.common.session.StandardSessionManager;
import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.DataProvider; import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.util.Map; import java.util.Map;
/** /**
* 测试消息路由器 * 测试消息路由器
* @author chanjarster
* *
* @author chanjarster
*/ */
@Test @Test
public class WxMpMessageRouterTest { public class WxMpMessageRouterTest {
@@ -97,6 +96,7 @@ public class WxMpMessageRouterTest {
Thread.sleep(1000l * 2); Thread.sleep(1000l * 2);
} }
@DataProvider(name = "messages-1") @DataProvider(name = "messages-1")
public Object[][] messages2() { public Object[][] messages2() {
WxMpXmlMessage message1 = new WxMpXmlMessage(); WxMpXmlMessage message1 = new WxMpXmlMessage();
@@ -150,25 +150,6 @@ public class WxMpMessageRouterTest {
} }
public static class WxEchoMpMessageHandler implements WxMpMessageHandler {
private StringBuffer sb;
private String echoStr;
public WxEchoMpMessageHandler(StringBuffer sb, String echoStr) {
this.sb = sb;
this.echoStr = echoStr;
}
@Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService,
WxSessionManager sessionManager) {
this.sb.append(this.echoStr).append(',');
return null;
}
}
@DataProvider @DataProvider
public Object[][] standardSessionManager() { public Object[][] standardSessionManager() {
@@ -290,6 +271,25 @@ public class WxMpMessageRouterTest {
} }
} }
public static class WxEchoMpMessageHandler implements WxMpMessageHandler {
private StringBuffer sb;
private String echoStr;
public WxEchoMpMessageHandler(StringBuffer sb, String echoStr) {
this.sb = sb;
this.echoStr = echoStr;
}
@Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService,
WxSessionManager sessionManager) {
this.sb.append(this.echoStr).append(',');
return null;
}
}
public static class WxSessionMessageHandler implements WxMpMessageHandler { public static class WxSessionMessageHandler implements WxMpMessageHandler {
@Override @Override

View File

@@ -3,16 +3,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.test.ApiTestModule; import me.chanjar.weixin.mp.api.test.ApiTestModule;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Guice; import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.util.Arrays; import java.util.Arrays;
/** /**
*
* @author chanjarster * @author chanjarster
*
*/ */
@Test(groups = "miscAPI") @Test(groups = "miscAPI")
@Guice(modules = ApiTestModule.class) @Guice(modules = ApiTestModule.class)

View File

@@ -3,9 +3,8 @@ 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.test.ApiTestModule; import me.chanjar.weixin.mp.api.test.ApiTestModule;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Guice; import org.testng.annotations.*;
import org.testng.annotations.Test;
/** /**
* 测试短连接 * 测试短连接

View File

@@ -2,17 +2,17 @@ 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.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
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.*;
import org.testng.annotations.Test;
import static org.testng.AssertJUnit.assertNotNull; import static org.testng.AssertJUnit.*;
/** /**
* 测试代码仅供参考,未做严格测试,因原接口作者并未提供单元测试代码 * 测试代码仅供参考,未做严格测试,因原接口作者并未提供单元测试代码
* Created by Binary Wang on 2016/7/27. * Created by Binary Wang on 2016/7/27.
*
* @author binarywang (https://github.com/binarywang) * @author binarywang (https://github.com/binarywang)
*/ */
@Test @Test

View File

@@ -1,39 +1,30 @@
package me.chanjar.weixin.mp.api.impl; 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.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.bean.datacube.*;
import org.apache.commons.lang3.time.FastDateFormat;
import org.testng.*;
import org.testng.annotations.*;
import java.text.ParseException; 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.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import com.google.inject.Inject;
import me.chanjar.weixin.common.exception.WxErrorException;
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;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeMsgResult;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary;
/** /**
* 测试统计分析相关的接口 * 测试统计分析相关的接口
* Created by Binary Wang on 2016/8/23. * Created by Binary Wang on 2016/8/23.
*
* @author binarywang (https://github.com/binarywang) * @author binarywang (https://github.com/binarywang)
*/ */
@Guice(modules = ApiTestModule.class) @Guice(modules = ApiTestModule.class)
public class WxMpDataCubeServiceImplTest { public class WxMpDataCubeServiceImplTest {
private FastDateFormat simpleDateFormat = FastDateFormat
.getInstance("yyyy-MM-dd");
@Inject @Inject
protected WxMpService wxService; protected WxMpService wxService;
private FastDateFormat simpleDateFormat = FastDateFormat
.getInstance("yyyy-MM-dd");
@DataProvider @DataProvider
public Object[][] oneDay() throws ParseException { public Object[][] oneDay() throws ParseException {

View File

@@ -3,12 +3,10 @@ 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.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.bean.device.WxDeviceQrCodeResult; import me.chanjar.weixin.mp.bean.device.WxDeviceQrCodeResult;
import org.testng.annotations.DataProvider; import org.testng.annotations.*;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
/** /**
* Created by keungtung on 14/12/2016. * Created by keungtung on 14/12/2016.

View File

@@ -3,25 +3,23 @@ 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.common.exception.WxErrorException; import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage; import me.chanjar.weixin.mp.api.test.TestConfigStorage;
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;
import me.chanjar.weixin.mp.bean.kefu.result.*; import me.chanjar.weixin.mp.bean.kefu.result.*;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.DataProvider; import org.testng.annotations.*;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.io.File; import java.io.File;
import java.util.Date; import java.util.Date;
/** /**
* 测试客服相关接口 * 测试客服相关接口
* @author Binary Wang
* *
* @author Binary Wang
*/ */
@Test @Test
@Guice(modules = ApiTestModule.class) @Guice(modules = ApiTestModule.class)

View File

@@ -5,15 +5,10 @@ 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.common.util.fs.FileUtils; import me.chanjar.weixin.common.util.fs.FileUtils;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.material.WxMpMaterial; import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.bean.material.WxMpMaterialArticleUpdate;
import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews;
import me.chanjar.weixin.mp.bean.material.*; import me.chanjar.weixin.mp.bean.material.*;
import org.testng.annotations.DataProvider; import org.testng.annotations.*;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@@ -44,6 +39,8 @@ public class WxMpMaterialServiceImplTest {
private String multiNewsMediaId = ""; private String multiNewsMediaId = "";
// 先查询保存测试开始前永久素材数据 // 先查询保存测试开始前永久素材数据
private WxMpMaterialCountResult wxMaterialCountResultBeforeTest; private WxMpMaterialCountResult wxMaterialCountResultBeforeTest;
// 以下为media接口的测试
private List<String> mediaIdsToDownload = new ArrayList<>();
@DataProvider @DataProvider
public Object[][] mediaFiles() { public Object[][] mediaFiles() {
@@ -266,9 +263,6 @@ public class WxMpMaterialServiceImplTest {
return params.iterator(); return params.iterator();
} }
// 以下为media接口的测试
private List<String> mediaIdsToDownload = new ArrayList<>();
@Test(dataProvider = "mediaFiles") @Test(dataProvider = "mediaFiles")
public void testUploadMedia(String mediaType, String fileType, String fileName) throws WxErrorException, IOException { public void testUploadMedia(String mediaType, String fileType, String fileName) throws WxErrorException, IOException {
try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName)) { try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName)) {

View File

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

View File

@@ -3,8 +3,8 @@ package me.chanjar.weixin.mp.api.impl;
import com.github.binarywang.utils.qrcode.QrcodeUtils; import com.github.binarywang.utils.qrcode.QrcodeUtils;
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.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage; import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.pay.request.*; import me.chanjar.weixin.mp.bean.pay.request.*;
import me.chanjar.weixin.mp.bean.pay.result.*; import me.chanjar.weixin.mp.bean.pay.result.*;

View File

@@ -2,13 +2,11 @@ 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.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket; import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.DataProvider; import org.testng.annotations.*;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.io.File; import java.io.File;

View File

@@ -2,12 +2,11 @@ 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.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage; import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Guice; import org.testng.annotations.*;
import org.testng.annotations.Test;
@Test @Test
@Guice(modules = ApiTestModule.class) @Guice(modules = ApiTestModule.class)

View File

@@ -2,13 +2,12 @@ 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.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
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;
import org.testng.annotations.Guice; import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@@ -18,7 +17,6 @@ import static org.junit.Assert.assertNotNull;
/** /**
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> * @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016-09-23. * Created by Binary Wang on 2016-09-23.
*
*/ */
@Test @Test
@Guice(modules = ApiTestModule.class) @Guice(modules = ApiTestModule.class)
@@ -28,6 +26,7 @@ public class WxMpStoreServiceImplTest {
/** /**
* 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)}.
*
* @throws WxErrorException * @throws WxErrorException
*/ */
public void testAdd() throws WxErrorException { public void testAdd() throws WxErrorException {

View File

@@ -2,17 +2,16 @@ 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.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage; import me.chanjar.weixin.mp.api.test.TestConfigStorage;
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;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateIndustry; import me.chanjar.weixin.mp.bean.template.WxMpTemplateIndustry;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage; import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Guice; import org.testng.annotations.*;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;

View File

@@ -1,12 +1,11 @@
package me.chanjar.weixin.mp.api.impl; package me.chanjar.weixin.mp.api.impl;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage; import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult; import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Guice; import org.testng.annotations.*;
import org.testng.annotations.Test;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -1,23 +1,18 @@
package me.chanjar.weixin.mp.api.impl; package me.chanjar.weixin.mp.api.impl;
import java.util.ArrayList;
import java.util.List;
import me.chanjar.weixin.mp.api.WxMpService;
import org.testng.Assert;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
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.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule; import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage; import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.WxMpUserQuery; import me.chanjar.weixin.mp.bean.WxMpUserQuery;
import me.chanjar.weixin.mp.bean.result.WxMpUser; import me.chanjar.weixin.mp.bean.result.WxMpUser;
import me.chanjar.weixin.mp.bean.result.WxMpUserList; import me.chanjar.weixin.mp.bean.result.WxMpUserList;
import org.testng.*;
import org.testng.annotations.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* 测试用户相关的接口 * 测试用户相关的接口

View File

@@ -1,21 +1,17 @@
package me.chanjar.weixin.mp.api.impl; package me.chanjar.weixin.mp.api.impl;
import java.util.List;
import me.chanjar.weixin.mp.api.WxMpService;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import com.google.inject.Inject; import com.google.inject.Inject;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule; import me.chanjar.weixin.mp.api.test.ApiTestModule;
import me.chanjar.weixin.mp.api.test.TestConfigStorage; import me.chanjar.weixin.mp.api.test.TestConfigStorage;
import me.chanjar.weixin.mp.bean.tag.WxTagListUser; import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
import me.chanjar.weixin.mp.bean.tag.WxUserTag; import me.chanjar.weixin.mp.bean.tag.WxUserTag;
import org.testng.*;
import org.testng.annotations.*;
import java.util.List;
/** /**
*
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a> * @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
* Created by Binary Wang on 2016/9/2. * Created by Binary Wang on 2016/9/2.
*/ */

View File

@@ -2,8 +2,8 @@ package me.chanjar.weixin.mp.bean.kefu;
import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage.WxArticle; import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage.WxArticle;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpKefuMessageTest { public class WxMpKefuMessageTest {

View File

@@ -1,8 +1,8 @@
package me.chanjar.weixin.mp.bean.kefu.result; package me.chanjar.weixin.mp.bean.kefu.result;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpKfListTest { public class WxMpKfListTest {

View File

@@ -1,10 +1,8 @@
package me.chanjar.weixin.mp.bean.kefu.result; package me.chanjar.weixin.mp.bean.kefu.result;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
@Test @Test
public class WxMpKfOnlineListTest { public class WxMpKfOnlineListTest {

View File

@@ -1,8 +1,8 @@
package me.chanjar.weixin.mp.bean.message; package me.chanjar.weixin.mp.bean.message;
import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.api.WxConsts;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpXmlMessageTest { public class WxMpXmlMessageTest {

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.message; package me.chanjar.weixin.mp.bean.message;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpXmlOutImageMessageTest { public class WxMpXmlOutImageMessageTest {

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.message; package me.chanjar.weixin.mp.bean.message;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpXmlOutMusicMessageTest { public class WxMpXmlOutMusicMessageTest {

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.message; package me.chanjar.weixin.mp.bean.message;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpXmlOutNewsMessageTest { public class WxMpXmlOutNewsMessageTest {

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.message; package me.chanjar.weixin.mp.bean.message;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpXmlOutTextMessageTest { public class WxMpXmlOutTextMessageTest {

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.message; package me.chanjar.weixin.mp.bean.message;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
/** /**
* Created by ben on 2015/12/29. * Created by ben on 2015/12/29.

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.message; package me.chanjar.weixin.mp.bean.message;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpXmlOutVideoMessageTest { public class WxMpXmlOutVideoMessageTest {

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.message; package me.chanjar.weixin.mp.bean.message;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
@Test @Test
public class WxMpXmlOutVoiceMessageTest { public class WxMpXmlOutVoiceMessageTest {

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.pay.result; package me.chanjar.weixin.mp.bean.pay.result;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
import java.util.Map; import java.util.Map;

View File

@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.pay.result; package me.chanjar.weixin.mp.bean.pay.result;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
/** /**
* <pre> * <pre>

View File

@@ -1,8 +1,8 @@
package me.chanjar.weixin.mp.bean.pay.result; package me.chanjar.weixin.mp.bean.pay.result;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.Test; import org.testng.annotations.*;
/** /**
* <pre> * <pre>

View File

@@ -2,9 +2,8 @@ package me.chanjar.weixin.mp.bean.pay.result;
import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.XStream;
import me.chanjar.weixin.common.util.xml.XStreamInitializer; import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import org.testng.Assert; import org.testng.*;
import org.testng.annotations.BeforeTest; import org.testng.annotations.*;
import org.testng.annotations.Test;
public class WxPaySendRedpackResultTest { public class WxPaySendRedpackResultTest {

View File

@@ -1,9 +1,5 @@
package me.chanjar.weixin.mp.demo; package me.chanjar.weixin.mp.demo;
import java.util.Map;
import java.util.Random;
import java.util.regex.Pattern;
import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.session.WxSession; import me.chanjar.weixin.common.session.WxSession;
import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.session.WxSessionManager;
@@ -14,6 +10,10 @@ import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import java.util.Map;
import java.util.Random;
import java.util.regex.Pattern;
public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMatcher { public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMatcher {
private Random random = new Random(); private Random random = new Random();

View File

@@ -13,17 +13,16 @@ import java.io.InputStream;
@XStreamAlias("xml") @XStreamAlias("xml")
class WxMpDemoInMemoryConfigStorage extends WxMpInMemoryConfigStorage { class WxMpDemoInMemoryConfigStorage extends WxMpInMemoryConfigStorage {
@Override
public String toString() {
return "SimpleWxConfigProvider [appId=" + this.appId + ", secret=" + this.secret + ", accessToken=" + this.accessToken
+ ", expiresTime=" + this.expiresTime + ", token=" + this.token + ", aesKey=" + this.aesKey + "]";
}
public static WxMpDemoInMemoryConfigStorage fromXml(InputStream is) { public static WxMpDemoInMemoryConfigStorage fromXml(InputStream is) {
XStream xstream = XStreamInitializer.getInstance(); XStream xstream = XStreamInitializer.getInstance();
xstream.processAnnotations(WxMpDemoInMemoryConfigStorage.class); xstream.processAnnotations(WxMpDemoInMemoryConfigStorage.class);
return (WxMpDemoInMemoryConfigStorage) xstream.fromXML(is); return (WxMpDemoInMemoryConfigStorage) xstream.fromXML(is);
} }
@Override
public String toString() {
return "SimpleWxConfigProvider [appId=" + this.appId + ", secret=" + this.secret + ", accessToken=" + this.accessToken
+ ", expiresTime=" + this.expiresTime + ", token=" + this.token + ", aesKey=" + this.aesKey + "]";
}
} }

View File

@@ -1,18 +1,17 @@
package me.chanjar.weixin.mp.demo; package me.chanjar.weixin.mp.demo;
import java.io.IOException;
import java.io.InputStream;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.mp.api.WxMpConfigStorage; import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import me.chanjar.weixin.mp.api.WxMpMessageHandler; import me.chanjar.weixin.mp.api.WxMpMessageHandler;
import me.chanjar.weixin.mp.api.WxMpMessageRouter; import me.chanjar.weixin.mp.api.WxMpMessageRouter;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import java.io.IOException;
import java.io.InputStream;
public class WxMpDemoServer { public class WxMpDemoServer {

View File

@@ -1,16 +1,15 @@
package me.chanjar.weixin.mp.demo; package me.chanjar.weixin.mp.demo;
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken; import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
import me.chanjar.weixin.mp.bean.result.WxMpUser; import me.chanjar.weixin.mp.bean.result.WxMpUser;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class WxMpOAuth2Servlet extends HttpServlet { public class WxMpOAuth2Servlet extends HttpServlet {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;