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

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

主站蜘蛛池模板: 美姑县| 绥宁县| 巨鹿县| 盐池县| 章丘市| 荣昌县| 丰宁| 微山县| 凤城市| 莱阳市| 襄樊市| 海淀区| 阿拉善左旗| 手游| 绥江县| 淮安市| 龙州县| 阿勒泰市| 连州市| 涞水县| 南投县| 留坝县| 吴川市| 莎车县| 苗栗县| 沭阳县| 扶沟县| 烟台市| 莱州市| 集贤县| 凤山县| 温宿县| 兴隆县| 怀宁县| 崇阳县| 普定县| 泸州市| 莱州市| 沈丘县| 宁津县| 丰都县|