- 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/.
推薦閱讀
- Flask Web全棧開發實戰
- Getting Started with ResearchKit
- Visual Basic程序設計教程
- C語言從入門到精通(第4版)
- Visual Basic程序設計實驗指導(第4版)
- Python機器學習算法與實戰
- C語言程序設計同步訓練與上機指導(第三版)
- C++從入門到精通(第5版)
- IBM Cognos TM1 Developer's Certification guide
- Practical Microservices
- Python 3 Object:oriented Programming(Second Edition)
- 游戲設計的底層邏輯
- Visual Basic語言程序設計上機指導與練習(第3版)
- Android開發權威指南(第二版)
- Visual FoxPro程序設計