diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMiscAPITest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMiscAPITest.java deleted file mode 100644 index d8ed016b..00000000 --- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMiscAPITest.java +++ /dev/null @@ -1,29 +0,0 @@ -package me.chanjar.weixin.mp.api; - -import com.google.inject.Inject; -import me.chanjar.weixin.common.error.WxErrorException; -import me.chanjar.weixin.mp.api.test.ApiTestModule; -import org.testng.*; -import org.testng.annotations.*; - -import java.util.Arrays; - -/** - * @author chanjarster - */ -@Test(groups = "miscAPI") -@Guice(modules = ApiTestModule.class) -public class WxMpMiscAPITest { - - @Inject - protected WxMpService wxService; - - @Test - public void testGetCallbackIP() throws WxErrorException { - String[] ipArray = this.wxService.getCallbackIP(); - System.out.println(Arrays.toString(ipArray)); - Assert.assertNotNull(ipArray); - Assert.assertNotEquals(ipArray.length, 0); - } - -} diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpShortUrlAPITest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpShortUrlAPITest.java deleted file mode 100644 index 2117b984..00000000 --- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpShortUrlAPITest.java +++ /dev/null @@ -1,33 +0,0 @@ -package me.chanjar.weixin.mp.api; - -import com.google.inject.Inject; -import me.chanjar.weixin.common.error.WxErrorException; -import me.chanjar.weixin.mp.api.test.ApiTestModule; -import org.testng.*; -import org.testng.annotations.*; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * 测试短连接 - * - * @author chanjarster - */ -@Test -@Guice(modules = ApiTestModule.class) -public class WxMpShortUrlAPITest { - @Inject - protected WxMpService wxService; - - public void testShortUrl() throws WxErrorException { - String shortUrl = this.wxService.shortUrl("http://www.baidu.com/test?access_token=123"); - assertThat(shortUrl).isNotEmpty(); - System.out.println(shortUrl); - } - - @Test(expectedExceptions = WxErrorException.class) - public void testShortUrl_with_exceptional_url() throws WxErrorException { - this.wxService.shortUrl("http://www.baidu.com/test?redirect_count=1&access_token=123"); - } - -} diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImplTest.java index 7f3e6ab3..18b719d9 100644 --- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImplTest.java +++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImplTest.java @@ -11,6 +11,8 @@ import org.testng.Assert; import org.testng.annotations.Guice; import org.testng.annotations.Test; +import java.util.Arrays; + import static org.assertj.core.api.Assertions.assertThat; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; @@ -93,4 +95,23 @@ public class BaseWxMpServiceImplTest { Assert.assertEquals(result.getPingInfos().get(1), pingInfo); } + + @Test + public void testGetCallbackIP() throws WxErrorException { + String[] ipArray = this.wxService.getCallbackIP(); + System.out.println(Arrays.toString(ipArray)); + Assert.assertNotNull(ipArray); + Assert.assertNotEquals(ipArray.length, 0); + } + + public void testShortUrl() throws WxErrorException { + String shortUrl = this.wxService.shortUrl("http://www.baidu.com/test?access_token=123"); + assertThat(shortUrl).isNotEmpty(); + System.out.println(shortUrl); + } + + @Test(expectedExceptions = WxErrorException.class) + public void testShortUrl_with_exceptional_url() throws WxErrorException { + this.wxService.shortUrl("http://www.baidu.com/test?redirect_count=1&access_token=123"); + } }