目录前言..................................................................................................................................................... 61、为什么要写电子书.............................................................................................................. 62、为什么要总结 PowerMock...............................................................................................73、分享是一种美德.................................................................................................................. 84、感谢.......................................................................................................................................8如何阅读............................................................................................................................................. 9参考资料............................................................................................................................................. 9适合人群............................................................................................................................................. 9一、PowerMock 介绍................................................................................................................... 101.1、PowerMock 不是重复发明轮子................................................................................. 101.2、PowerMock 解决了什么问题......................................................................................111.3、如何获得 PowerMock..................................................................................................111.4、如何安装 PowerMock..................................................................................................12二、PowerMock 入门................................................................................................................... 122.1、使用场景......................................................................................................................... 122.2、PowerMock 之 HelloWorld.......................................................................................142.2.1、获取所有员工的个数..........................................................................................142.2.2、创建员工..............................................................................................................172.3、重点 API 解释.................................................................................................................182.3.1、Mock................................................................................................................... 182.3.2、Do..when..then................................................................................................. 18Programming 系列丛书2.3.3、Verify...................................................................................................................192.4、总结................................................................................................................................. 19三、 Mock Local Variable...........................................................................................................193.1、有返回值......................................................................................................................... 193.2、局部变量的 void 方法...................................................................................................223.3、@RunWith 和@PrepareForTest 介绍......................................................................233.4、总结................................................................................................................................. 24四、 Mock Static...........................................................................................................................254.1、问题场景......................................................................................................................... 254.2、单元测试......................................................................................................................... 264.3、使用 Mock......................................................................................................................27五、 Verifying................................................................................................................................285.1、使用场景......................................................................................................................... 285.2、业务代码......................................................................................................................... 295.3、测试代码......................................................................................................................... 315.4、Verifying 其他 API........................................................................................................33六、 Mock final.............................................................................................................................336.1、业务代码......................................................................................................................... 336.2、EasyMock 测试............................................................................................................. 346.3、PowerMock 测试..........................................................................................................37七、 Mock constructors............................................................................................................. 387.1、使用场景......................................................................................................................... 38Programming 系列丛书7.2、业务代码......................................................................................................................... 387.3、PowerMock 测试..........................................................................................................397.4、whenNew 语法............................................................................................................. 40八、 Arguments Matcher...........................................................................................................418.1、使用场景......................................................................................................................... 418.2、业务代码......................................................................................................................... 418.3、PowerMock 测试..........................................................................................................42九、 Answer interface.................................................................................................................449.1、使用场景......................................................................................................................... 449.2、业务代码......................................................................................................................... 449.3、PowerMock 测试..........................................................................................................459.4、answer 接口中参数 InvocationOnMock.................................................................46十、Mocking with spies..............................................................................................................4710.1、使用场景.......................................................................................................................4710.2、PowerMock 测试....................................................................................................... 4810.3、何时使用 Spy...............................................................................................................49十一、 Mocking private methods........................................................................................... 4911.1、使用场景.......................................................................................................................4911.2、业务代码.......................................................................................................................5011.3、PowerMock 测试....................................................................................................... 50十二、 总结.....................................................................................................................................51
下载PowerMock实战手册.pdf用户还喜欢
- 18480 文章数
- 500万+ 热度
作者专栏
编辑推荐
- 淡抹u2引擎,修复内容较多,物有所值
- 界域传说·经典巨作=传世单机(一键安装)
- 丸子版本(175个传世版本大集合)
- GS版本:神话公益服务端+客户端
- 图片放大工具(放大图片不模糊)
- 剪映无限制VIP版
- 传奇世界客户端下载器,史上最全传世客户端
- 传世GS20220920商业引擎注册+登录配置器 解压密码是1
- U2官方排行榜游戏网关 支持元神,支持传家宝
- GS开战传世客户端+服务端
- (淡漠夕阳)u2引擎合区工具
- 传世GS引擎消除“你的游戏客户端版本号过旧,请及时更新”提示
- 传世一机多区双线路配置器--免密码版本
- 传世凤凰登陆器劫持修复软件
- SQLite3 for Navicat
- 传奇世界npc对话框编辑工具
- 传世GS落霞铭文服务器端
- gs_20210409引擎包+注册机(无限制)
- 传奇世界NPC对话封包查看器[支持时长版和极速版]
- 彩虹引擎传世脚本编辑工具1.7版来了,支持函数脚本翻译
评论