You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Object[] objects = new Object[] {null, null};
assertThat(objects, arrayContaining(null, null));
cause NullPointerException:
java.lang.NullPointerException
at org.hamcrest.collection.IsIterableContainingInOrder$MatchSeries.isMatched(IsIterableContainingInOrder.java:65)
at org.hamcrest.collection.IsIterableContainingInOrder$MatchSeries.matches(IsIterableContainingInOrder.java:52)
at org.hamcrest.collection.IsIterableContainingInOrder.matchesSafely(IsIterableContainingInOrder.java:25)
at org.hamcrest.collection.IsIterableContainingInOrder.matchesSafely(IsIterableContainingInOrder.java:14)
at org.hamcrest.TypeSafeDiagnosingMatcher.matches(TypeSafeDiagnosingMatcher.java:55)
at org.hamcrest.collection.IsArrayContainingInOrder.matchesSafely(IsArrayContainingInOrder.java:26)
at org.hamcrest.collection.IsArrayContainingInOrder.matchesSafely(IsArrayContainingInOrder.java:15)
at org.hamcrest.TypeSafeMatcher.matches(TypeSafeMatcher.java:65)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:12)
at org.junit.Assert.assertThat(Assert.java:865)
at org.junit.Assert.assertThat(Assert.java:832)
The text was updated successfully, but these errors were encountered:
The problem is that overloading is picking up arrayContaining(Matcher matcher) rather than arrayContaining(T object). I need to add some kind of null check.
Has hamcrest 1.3 and junit 4.11
Code:
Object[] objects = new Object[] {null, null};
assertThat(objects, arrayContaining(null, null));
cause NullPointerException:
java.lang.NullPointerException
at org.hamcrest.collection.IsIterableContainingInOrder$MatchSeries.isMatched(IsIterableContainingInOrder.java:65)
at org.hamcrest.collection.IsIterableContainingInOrder$MatchSeries.matches(IsIterableContainingInOrder.java:52)
at org.hamcrest.collection.IsIterableContainingInOrder.matchesSafely(IsIterableContainingInOrder.java:25)
at org.hamcrest.collection.IsIterableContainingInOrder.matchesSafely(IsIterableContainingInOrder.java:14)
at org.hamcrest.TypeSafeDiagnosingMatcher.matches(TypeSafeDiagnosingMatcher.java:55)
at org.hamcrest.collection.IsArrayContainingInOrder.matchesSafely(IsArrayContainingInOrder.java:26)
at org.hamcrest.collection.IsArrayContainingInOrder.matchesSafely(IsArrayContainingInOrder.java:15)
at org.hamcrest.TypeSafeMatcher.matches(TypeSafeMatcher.java:65)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:12)
at org.junit.Assert.assertThat(Assert.java:865)
at org.junit.Assert.assertThat(Assert.java:832)
The text was updated successfully, but these errors were encountered: