找传奇、传世资源到传世资源站!

PowerMock实战手册.pdf

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

from clipboard目录前言..................................................................................................................................................... 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

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复