Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to install mockito into Eclipse?

6,392 views
Skip to first unread message

Xue Feng

unread,
Sep 30, 2017, 5:42:12 AM9/30/17
to
Hi,

I am learning how to using mockito to test. I want to use mockito
within Eclipse. I have two questions about how to install the mockito
library:
1. I have downloaded mockito-all-1.9.5.jar, and added it to the java
build path of a project within Eclipse. The tests works well. But, when
using new mockito-core-2.x.jar(it seems that mockito-all-2.x.jar does
not release any more), there are some libraries to be install
additionally to make mockito work. That is to say, mockito depends these
libraries. But, I have no idea which libraries are needed, and the
documents of mockito have no suggestions about it.
2. For every project, I have to add the jar of mockito into the java
build path within Eclipse. Is there any way to set the mockito to be
default library for each project created newly, just like junit?
Thanks!

Stanimir Stamenkov

unread,
Oct 1, 2017, 8:35:02 AM10/1/17
to
Use Maven or Gradle to declare your project dependencies:

http://site.mockito.org/#how

http://search.maven.org/#artifactdetails|org.mockito|mockito-core|2.10.0|jar

Make sure you have Maven and/or Gradle support added to your Eclipse
installation:

https://www.eclipse.org/m2e
https://www.eclipse.org/buildship

Your Eclipse package likely comes with Maven support, already:

https://www.eclipse.org/downloads/compare.php

--
Stanimir
0 new messages