13
在IntelliJ 10.5中运行测试时得到“ NoSuchMethodError:org.hamcrest.Matcher.describeMismatch”
我正在使用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 …