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

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

主站蜘蛛池模板: 江西省| 华安县| 吉首市| 论坛| 扶余县| 北安市| 清苑县| 达拉特旗| 辛集市| 泸西县| 濉溪县| 景宁| 宁乡县| 汝州市| 潜山县| 蒲城县| 肥城市| 庐江县| 福泉市| 佛教| 开江县| 谢通门县| 甘南县| 呈贡县| 滦南县| 梨树县| 中西区| 龙井市| 西青区| 瑞丽市| 额济纳旗| 长沙县| 湛江市| 广宁县| 高密市| 芦山县| 马山县| 恩施市| 宜阳县| 伊金霍洛旗| 龙山县|