mockito简单教程

什么是Mockito?

官网解释:

Mockito is a mocking framework that tastes really good. It lets you write beautiful tests with a clean & simple API. Mockito doesn’t give you hangover because the tests are very readable and they produce clean verification errors.

也就是说Mocket  非常具有可读性,并且产出非常干净的错误输出。我使用的原因是不想链接数据库,所以使用它。

可以查看下面的Blog:因为我也是从此转载的

http://blog.csdn.net/sdyy321/article/details/38757135/

详细讲解:

http://blog.csdn.net/bboyfeiyu/article/details/52127551

碰到的问题:

Could not initialize plugin: interface org.mockito.plugins.MockMaker

需要添加下面的Jar包

  • byte-buddy-1.6.5.jar
  • byte-buddy-agent-1.6.5.jar
  • objenesis-2.5.jar

Since Mockito 2.0.2 beta, Mockito-core has dependencies. 

原文地址:https://www.cnblogs.com/mythdoraemon/p/7750584.html