问题描述
我了解解决方案是以某种方式确保在Juncrest之后加载Junit.我有一个intellij项目,在其中设置了一个外部库,其中包含JUnit和JMock以及hamcrest.如何确定此错误不会出现
I understand that the solution is to somehow make sure that Junit is loaded after hamcrest. I have an intellij project, in which I setup an external library, which contains both JUnit and JMock and hamcrest. How can I make sure that this error does not show up
推荐答案
您应确保库(jar)的兼容性.如果jar中的类使用另一个jar中的类中的某个方法,并且此使用的方法是新添加的,并且您正在使用旧的jar,则肯定会得到java.lang.NoSuchMethodError
.
You should make sure the compatibility of libraries(jars). If a class inside jar uses some method from class which is in another jar, and this used method is newly added and you are using old jar then definitely you will get java.lang.NoSuchMethodError
.
这篇关于JMock-java.lang.NoSuchMethodError:org.hamcrest.Matcher.describeMismatch()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!