我正在使用JUnit-dep 4.10和Hamcrest 1.3.RC2。
我创建了一个自定义匹配器,看起来像下面这样:
public static class MyMatcher extends TypeSafeMatcher<String> {
@Override
protected boolean matchesSafely(String s) {
/* implementation */
}
@Override
public void describeTo(Description description) {
/* implementation */
}
@Override
protected void describeMismatchSafely(String item, Description mismatchDescription) {
/* implementation */
}
}
在使用Ant命令行运行时,它完美地工作。但是在使用IntelliJ运行时,它会失败,显示以下错误:
java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)
at com.netflix.build.MyTest.testmyStuff(MyTest.java:40)
我猜测它正在使用错误的 hamcrest.MatcherAssert。 我如何找出它正在使用哪个 hamcrest.MatcherAssert(即哪个 jar 文件用于 hamcrest.MatcherAssert)? 据我所知,我的类路径中唯一的 hamcrest jars 是 1.3.RC2。
IntelliJ IDEA 是否在使用自己的 JUnit 或 Hamcrest 副本?
如何输出 IntelliJ 正在使用的运行时 CLASSPATH?