官术网_书友最值得收藏!

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/.

主站蜘蛛池模板: 伊宁县| 突泉县| 罗江县| 镇巴县| 东辽县| 龙泉市| 时尚| 运城市| 恭城| 巴中市| 肇东市| 包头市| 东乌| 大关县| 绥宁县| 恩施市| 盱眙县| 青海省| 唐山市| 五寨县| 晋江市| 札达县| 万荣县| 靖宇县| 南阳市| 武清区| 微山县| 于田县| 赤峰市| 珲春市| 滨州市| 盐亭县| 沙洋县| 漳州市| 三亚市| 达州市| 瓦房店市| 广水市| 金山区| 巨鹿县| 武清区|