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
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
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
.You need to import junit-dep.jar (which doesn't include the hamcrest dependency!?), rather than junit.jar. If you're using Maven on a large project, this can involve a lot of chasing to flush out all the obscure hamcrest and junit imports.
It might help that the upcoming release of junit will be compatible with hamcrest 1.3