You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by Siddhi Mehta <si...@gmail.com> on 2015/07/03 22:29:17 UTC

ClassNotFoundException caused by mixing Mockito &Hamcrest

Hello All,

I was trying to use Junit ExpectedException for a test and I see a class
not found exception
java.lang.NoSuchMethodError: org/hamcrest/Matcher.describeMismatch

Reading the blog
<https://tedvinke.wordpress.com/2013/12/17/mixing-junit-hamcrest-and-mockito-explaining-nosuchmethoderror/>
seems like the issue maybe caused by using mockito-all which bundles in an
older version of hamcrest.

I was wondering if anyone else has encounter the issue.
Also wondering if we can switch to using mockito-core instead of
mockito-all?

-- 
Regards,
Siddhi

Re: ClassNotFoundException caused by mixing Mockito &Hamcrest

Posted by "王晓磊(络石)" <lu...@alibaba-inc.com>.
may be the JAR version is not expected.

check the dependency use:  mvn dependency:tree
-- 

jaywong — Sent with Airmail

在 2015年7月7日 上午8:42:25, James Taylor (jamestaylor@apache.org) 写到:

Hi Siddhi,  
I'm not familiar with the Mockito code, but if your solution passes all  
unit tests and is better, then I think it's fine.  
Thanks,  
James  

On Friday, July 3, 2015, Siddhi Mehta <si...@gmail.com> wrote:  

> Hello All,  
>  
> I was trying to use Junit ExpectedException for a test and I see a class  
> not found exception  
> java.lang.NoSuchMethodError: org/hamcrest/Matcher.describeMismatch  
>  
> Reading the blog  
> <  
> https://tedvinke.wordpress.com/2013/12/17/mixing-junit-hamcrest-and-mockito-explaining-nosuchmethoderror/  
> >  
> seems like the issue maybe caused by using mockito-all which bundles in an  
> older version of hamcrest.  
>  
> I was wondering if anyone else has encounter the issue.  
> Also wondering if we can switch to using mockito-core instead of  
> mockito-all?  
>  
> --  
> Regards,  
> Siddhi  
>  

Re: ClassNotFoundException caused by mixing Mockito &Hamcrest

Posted by James Taylor <ja...@apache.org>.
Hi Siddhi,
I'm not familiar with the Mockito code, but if your solution passes all
unit tests and is better, then I think it's fine.
Thanks,
James

On Friday, July 3, 2015, Siddhi Mehta <si...@gmail.com> wrote:

> Hello All,
>
> I was trying to use Junit ExpectedException for a test and I see a class
> not found exception
> java.lang.NoSuchMethodError: org/hamcrest/Matcher.describeMismatch
>
> Reading the blog
> <
> https://tedvinke.wordpress.com/2013/12/17/mixing-junit-hamcrest-and-mockito-explaining-nosuchmethoderror/
> >
> seems like the issue maybe caused by using mockito-all which bundles in an
> older version of hamcrest.
>
> I was wondering if anyone else has encounter the issue.
> Also wondering if we can switch to using mockito-core instead of
> mockito-all?
>
> --
> Regards,
> Siddhi
>