간단한 나는 그래서 난()이, NULL 또는 두 인스턴스 중 하나를 반환 다음 ensre 싶습니다 어설, null의 경우, 또는 특정 클래스의 인스턴스가
Assert.assertThat(
iterator.next(),
Matchers.either(Matchers.nullValue()).or(
Matchers.instanceOf(Double.class)));
생각입니다.
Assert.assertTrue(next == null || next instanceof Double);
테스트 실행 (assertThat
) 같은 Sth를이에 ...
java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V
at org.hamcrest.core.CombinableMatcher.matchesSafely(CombinableMatcher.java:17)
at org.hamcrest.TypeSafeDiagnosingMatcher.matches(TypeSafeDiagnosingMatcher.java:55)
at org.junit.Assert.assertThat(Assert.java:772)
at org.junit.Assert.assertThat(Assert.java:738
이유는 성과? 그리고 고치는 방법? 당신이 옳았
편집, Mockito에서 hamcrest LIB오고와의 충돌이 있었다. 나는 그것을 고쳤다. THER의 오류없이하지만 주장이 이상하게 실패가 좀 걸릴 :
java.lang.AssertionError:
Expected: (null or an instance of java.lang.Double)
got: null
at org.junit.Assert.assertThat(Assert.java:780)
at org.junit.Assert.assertThat(Assert.java:738)
이 널 (null)이 예상을, 널 가지고 및 테스트가 실패합니다.
을 가능한 복제본 [JMock-java.lang.NoSuchMethodError : org.hamcrest.Matcher.describeMismatch()] (http://stackoverflow.com/questions/12070514/jmock-java-lang-nosuchmethoderror-org-hamcrest-mat 쉐어 - 설명 불일치) –