1
0
mirror of synced 2025-12-22 00:48:00 +08:00

polish code

This commit is contained in:
Daniel Qian
2014-08-22 16:08:30 +08:00
parent e5e729918b
commit c2b166becc
8 changed files with 16 additions and 21 deletions

View File

@@ -28,16 +28,16 @@ public class WxServiceTest {
InputStream is1 = ClassLoader.getSystemResourceAsStream("test-config.xml");
WxXmlConfigStorage config1 = XmlTransformer.fromXml(WxXmlConfigStorage.class, is1);
this.wxService = new WxServiceImpl();
this.wxService.setWxConfigProvider(config1);
this.wxService.setWxConfigStorage(config1);
}
@Test
public void testRefreshAccessToken() throws WxErrorException {
WxConfigStorage configProvider = wxService.wxConfigProvider;
String before = configProvider.getAccessToken();
WxConfigStorage configStorage = wxService.wxConfigStorage;
String before = configStorage.getAccessToken();
wxService.refreshAccessToken();
String after = configProvider.getAccessToken();
String after = configStorage.getAccessToken();
Assert.assertNotEquals(before, after);
Assert.assertTrue(StringUtils.isNotBlank(after));
@@ -45,7 +45,7 @@ public class WxServiceTest {
@Test(dependsOnMethods = "testRefreshAccessToken")
public void sendCustomMessage() throws WxErrorException {
WxXmlConfigStorage configProvider = (WxXmlConfigStorage) wxService.wxConfigProvider;
WxXmlConfigStorage configProvider = (WxXmlConfigStorage) wxService.wxConfigStorage;
WxCustomMessage message = new WxCustomMessage();
message.setMsgtype(WxConsts.MSG_TEXT);
message.setTouser(configProvider.getOpenId());

View File

@@ -4,7 +4,6 @@ import org.testng.Assert;
import org.testng.annotations.Test;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxCustomMessage;
import chanjarster.weixin.bean.WxCustomMessage.WxArticle;
@Test

View File

@@ -3,8 +3,6 @@ package chanjarster.weixin.bean;
import org.testng.Assert;
import org.testng.annotations.Test;
import chanjarster.weixin.bean.WxError;
@Test
public class WxErrorTest {

View File

@@ -4,7 +4,6 @@ import org.testng.Assert;
import org.testng.annotations.Test;
import chanjarster.weixin.api.WxConsts;
import chanjarster.weixin.bean.WxXmlMessage;
@Test
public class WxXmlMessageTest {