首页 > 其他 > 详细

Mock之easymock, powermock, and mockito

时间:2016-06-13 19:11:19      阅读:203      评论:0      收藏:0      [点我收藏+]

easymock, powermock, and mockito


Easymock Class Mocking Limitations

    To be coherent with interface mocking, EasyMock provides a built-in behavior for equals(), toString(), hashCode() and finalize() even for class mocking. It means that you cannot record your own behavior for these methods. This limitation is considered to be a feature that prevents you from having to care about these methods.
    Final methods cannot be mocked. If called, their normal code will be executed.
    Private methods cannot be mocked. If called, their normal code will be executed. During partial mocking, if your method under test is calling some private methods, you will need to test them as well since you cannot mock them.
    Class instantiation is performed using Objenesis. Supported JVMs are listed here.

--from http://easymock.org/user-guide.html


EasyMock Add-ons

    Powermock is built on top of EasyMock. It uses a custom classloader and bytecode manipulation to enable mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more

 

 

Junit and EasyMock

https://dzone.com/refcardz/junit-and-easymock

 

Mock之easymock, powermock, and mockito

原文:http://www.cnblogs.com/bjfarmer/p/5416461.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!