Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #37514 > unrolled thread

How to install mockito into Eclipse?

Started byXue Feng <xf.lotus@yahoo.com>
First post2017-09-30 17:41 +0800
Last post2017-10-01 15:34 +0300
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  How to install mockito into Eclipse? Xue Feng <xf.lotus@yahoo.com> - 2017-09-30 17:41 +0800
    Re: How to install mockito into Eclipse? Stanimir Stamenkov <s7an10@netscape.net> - 2017-10-01 15:34 +0300

#37514 — How to install mockito into Eclipse?

FromXue Feng <xf.lotus@yahoo.com>
Date2017-09-30 17:41 +0800
SubjectHow to install mockito into Eclipse?
Message-ID<oqnot0$ban$1@gioia.aioe.org>
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!

[toc] | [next] | [standalone]


#37517

FromStanimir Stamenkov <s7an10@netscape.net>
Date2017-10-01 15:34 +0300
Message-ID<oqqnd6$gqd$1@dont-email.me>
In reply to#37514
On Sat, 30 Sep 2017 17:41:48 +0800, _Xue Feng_ wrote:

>     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?

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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web