实现获取自定义菜单配置的接口 for #70

This commit is contained in:
Binary Wang
2016-11-25 16:31:59 +08:00
parent fd4505d606
commit 95821dab20
6 changed files with 389 additions and 24 deletions

View File

@ -1,18 +1,17 @@
package me.chanjar.weixin.mp.api.impl;
import me.chanjar.weixin.mp.api.WxMpService;
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.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.WxMpService;
import me.chanjar.weixin.mp.bean.menu.WxMpGetSelfMenuInfoResult;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
/**
* 测试菜单
@ -28,11 +27,22 @@ public class WxMpMenuServiceImplTest {
protected WxMpService wxService;
@Test(dataProvider = "menu")
public void testCreateMenu(WxMenu wxMenu) throws WxErrorException {
public void testMenuCreate(WxMenu wxMenu) throws WxErrorException {
System.out.println(wxMenu.toJson());
this.wxService.getMenuService().menuCreate(wxMenu);
}
@Test
public void testMenuTryMatch() throws Exception {
//TODO
}
@Test
public void testGetSelfMenuInfo() throws Exception {
WxMpGetSelfMenuInfoResult selfMenuInfo = this.wxService.getMenuService().getSelfMenuInfo();
System.out.println(selfMenuInfo);
}
@Test
public void testCreateMenu2() throws WxErrorException {
String a = "{\n"
@ -77,15 +87,15 @@ public class WxMpMenuServiceImplTest {
this.wxService.getMenuService().menuCreate(menu);
}
@Test(dependsOnMethods = { "testCreateMenu"})
public void testGetMenu() throws WxErrorException {
@Test(dependsOnMethods = { "testMenuCreate"})
public void testMenuGet() throws WxErrorException {
WxMenu wxMenu = this.wxService.getMenuService().menuGet();
Assert.assertNotNull(wxMenu);
System.out.println(wxMenu.toJson());
}
@Test(dependsOnMethods = { "testGetMenu"})
public void testDeleteMenu() throws WxErrorException {
@Test(dependsOnMethods = { "testMenuGet"})
public void testMenuDelete() throws WxErrorException {
this.wxService.getMenuService().menuDelete();
}