什么是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.