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

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

主站蜘蛛池模板: 宁远县| 伊吾县| 宾阳县| 都江堰市| 德清县| 济宁市| 汤原县| 客服| 麟游县| 石门县| 治县。| 咸丰县| 尚义县| 察隅县| 黎川县| 五原县| 东方市| 泗阳县| 合江县| 铁岭县| 博白县| 黔东| 彭泽县| 通海县| 顺平县| 赤城县| 西充县| 台湾省| 土默特右旗| 宿迁市| 铁岭县| 姚安县| 彝良县| 什邡市| 栖霞市| 南靖县| 桐庐县| 栾城县| 平谷区| 科技| 唐山市|