在Maven测试用例中Hamcrest断言失败

时间:2018-06-14 13:01:00

标签: maven junit hamcrest

我正在使用Hamcrest Matchers来检查两个bean是否具有相同的属性值。它在Eclipse中运行良好但在使用cmd运行时失败。以下是相同的堆栈跟踪。有人可以帮忙吗?

java.lang.NoSuchFieldError: NONE
        at org.hamcrest.DiagnosingMatcher.matches(DiagnosingMatcher.java:12)
        at org.hamcrest.beans.SamePropertyValuesAs.hasMatchingValues(SamePropertyValuesAs.java:63)
        at org.hamcrest.beans.SamePropertyValuesAs.matchesSafely(SamePropertyValuesAs.java:31)
        at org.hamcrest.TypeSafeDiagnosingMatcher.matches(TypeSafeDiagnosingMatcher.java:55)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:12)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)

我的代码如下:

assertThat(actualBean, samePropertyValuesAs(expectedBean));

0 个答案:

没有答案