- Test-Driven Java Development(Second Edition)
- Alex Garcia Viktor Farcic
- 136字
- 2021-06-24 18:31:49
Extra power for mocks
Both projects introduced earlier do not cover all types of methods or fields. Depending on the applied modifiers, such as static or final, a class, method, or field, can be out of range for Mockito or EasyMock. In such cases, we can use PowerMock to extend the mocking framework. This way, we can mock objects that can only be mocked in a tricky manner. However, one should be cautious with PowerMock since the necessity to use many of the features it provides is usually a sign of poor design. If you're working on a legacy code, PowerMock might be a good choice. Otherwise, try to design your code in such a way that PowerMock is not needed. We'll show you how to do that later on.
For more information, visit https://code.google.com/p/powermock/.
推薦閱讀
- HTML5+CSS3王者歸來
- R語言數(shù)據(jù)分析從入門到精通
- Java EE 6 企業(yè)級應(yīng)用開發(fā)教程
- Python程序設(shè)計(第3版)
- 實用防銹油配方與制備200例
- Python編程與幾何圖形
- Java網(wǎng)絡(luò)編程實戰(zhàn)
- 現(xiàn)代C++編程實戰(zhàn):132個核心技巧示例(原書第2版)
- HoloLens與混合現(xiàn)實開發(fā)
- Node學(xué)習(xí)指南(第2版)
- 代替VBA!用Python輕松實現(xiàn)Excel編程
- C語言程序設(shè)計實訓(xùn)教程與水平考試指導(dǎo)
- Elasticsearch Essentials
- Oracle Data Guard 11gR2 Administration Beginner's Guide
- 深度學(xué)習(xí)入門:基于Python的理論與實現(xiàn)