easyforgood / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

Mockito-all is incompatible with JUnit 4.11 #397

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add dependency to junit 4.11
2. Add dependency to mockito-all 1.9.5
3. Make a test having verify(mock, times(0)).send(any(SomeType.class));
4. Run mvn clean test 

What is the expected output? What do you see instead?
The expected output is for the test to run OK. Instead I see: 
org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Descriptio
n;)V

What version of the product are you using? On what operating system?
Mockito-all 1.9.5 on Unix

Please provide any additional information below.

The problem is that with JUnit 4.11 they have introduced the latest harmcrest 
library 1.3. which adds a new method namely describeMismatch and since the 
shadowing interface org.hamcrest.Matcher in mockito-all does not have this 
method, we get the error mentioned above.   

NOTE: This problem does not appear with mockito-core

Original issue reported on code.google.com by hristov...@gmail.com on 19 Nov 2012 at 1:38

GoogleCodeExporter commented 8 years ago
Yeah we are sticking with Hamcrest 1.1 in order to keep compatibility with 
older test code.

Anyway, I'd recommend using mockito-core. Also one day we might remove 
integrated JUnit support, and make it available through another dependency.

Anyway Hamcrest is becoming a bit more urgent as times goes by. Maybe we will 
plan it for Mockito 2.0

Original comment by brice.du...@gmail.com on 19 Nov 2012 at 1:45

GoogleCodeExporter commented 8 years ago
Run into the same problem...

I don't know why I chose mockito-all in the first place. So maybe there should 
be some clear statements that mockito-core should be used (maybe there exist 
those today?).

Original comment by js.cedar...@gmail.com on 8 Dec 2012 at 3:09

GoogleCodeExporter commented 8 years ago
Hey, I cannot reproduce this issue. I have a small Gradle project with junit 
4.11 and mockito-all 1.9.5 and everything works fine for me (i've reordered the 
classpath in various way but tests work for me just fine). Can you submit a 
small project that reproduces the issue? We can add it to our coverage.

Thanks for reporting!

Original comment by szcze...@gmail.com on 8 Dec 2012 at 8:14

GoogleCodeExporter commented 8 years ago
Hi, 

Do you have a GitHub account? If not I will submit an example project on my 
GitHub account and will give you a link to it. 

By the way do you have any intention on switching to GitHub?

Cheers,
Ivan 

Original comment by hristov...@gmail.com on 10 Dec 2012 at 8:54

GoogleCodeExporter commented 8 years ago
Hi,

Yes we moved the sources to github since a few weeks already :)
http://github.com/mockito/mockito

Original comment by brice.du...@gmail.com on 10 Dec 2012 at 9:27

GoogleCodeExporter commented 8 years ago
Ah, what a pleasant surprise. I was looking forward adding some features to 
mockito. As soon as possible I will create a small project and give you the 
link to it. I don't think I can create the project on the mockito's github 
account though, since I plan to create a gitrepo for this small project. 
Anyway, my first bug report statement is quite clear I think, so it suffice to 
take a look at the different versions of org.hamcrest.Matcher.describeMismatch 
in hamcrest library. 

Original comment by hristov...@gmail.com on 10 Dec 2012 at 9:47

GoogleCodeExporter commented 8 years ago
Cool, let us know when you have a repo with a project that reproduces the 
problem.

Cheers!

Original comment by szcze...@gmail.com on 10 Dec 2012 at 11:20

GoogleCodeExporter commented 8 years ago

Original comment by brice.du...@gmail.com on 4 Dec 2013 at 3:06

GoogleCodeExporter commented 8 years ago
I just ran into this issue as well. I was using a ExpectedException rule in 
JUnit 4.11 and the exception being thrown was different than expected, as a 
result I got a an error on the method described in the subject of this.
I will retry with the latest Mockito since we are still depending on 1.8.5

Original comment by david.nouls on 18 Feb 2014 at 9:55