Export to GitHub

mockito - issue #459

Hamcrest class conflicts


Posted on Oct 30, 2013 by Swift Lion

What steps will reproduce the problem? 1. include mockito-all:1.9.5, junit:4.11, hamcrest-library:1.3.0 2. Intermittently causes "java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(java/lang/Object;Lorg/hamcrest/Description)" 3.

What is the expected output? What do you see instead? No Exception should be thrown, Mockito should NOT package Hamcrest classes in its own jar, this obsolete version can not be managed through a build tool (Maven, Gradle, etc). It is simply a bad practice!

What version of the product are you using? On what operating system? mockito-all:1.9.5, junit:4.11, hamcrest-library:1.3.0 Windows & Mac

Please provide any additional information below. As a workaround, which is an unreliable hack is to put the hamcrest-library jar at the top of the maven dependencies. Clearly, this is not the optimal solution. Mockito MUST not include other project's packages, it is unmanageable!

Comment #1

Posted on Nov 21, 2013 by Grumpy Dog

Any updates?

Comment #2

Posted on Dec 4, 2013 by Happy Horse

(No comment was entered for this change.)

Comment #3

Posted on Dec 4, 2013 by Happy Horse

Indeed hamcrest update is becoming more urgent as many project now use an updated version.

By the way if you have a pull request on github it would be awesome.

Comment #4

Posted on Dec 16, 2013 by Swift Rabbit

Comment deleted

Comment #5

Posted on Dec 17, 2013 by Swift Rabbit

Pull request - https://github.com/mockito/mockito/pull/27

Comment #6

Posted on Dec 19, 2013 by Swift Rabbit

Travis build passes for the pull request

Comment #7

Posted on Dec 24, 2013 by Happy Horse

(No comment was entered for this change.)

Status: Duplicate

Labels:
Type-Defect Priority-High Hamcrest