- 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/.
推薦閱讀
- Apache Oozie Essentials
- 新一代通用視頻編碼H.266/VVC:原理、標準與實現
- Getting Started with ResearchKit
- EPLAN實戰設計
- Java:High-Performance Apps with Java 9
- LabVIEW虛擬儀器程序設計從入門到精通(第二版)
- QGIS Python Programming Cookbook(Second Edition)
- 一步一步跟我學Scratch3.0案例
- 零基礎輕松學C++:青少年趣味編程(全彩版)
- 零基礎學HTML+CSS第2版
- Moodle 3 Administration(Third Edition)
- Spring Boot從入門到實戰
- 計算機程序的構造和解釋(JavaScript版)
- 編寫高質量代碼之Java(套裝共2冊)
- Building Microservices with .NET Core 2.0(Second Edition)