@Theory public void failsWhenCollectionContainsOneItemMatchingMatcher(Collection<Object> collection) { assumeThat(collection, not(hasItem(isA(FourConstant.class)))); expectAssertionErrorForIncorrectNumberOfMatches("is not <4>", 1); assertThat(collection, CollectionMatchers.hasZeroItemsWith("value", is(not(4)))); }
@Theory public void succeedsWhenCollectionContainsZeroItemsMatchingMatcher( Collection<Object> collection) { assumeThat(collection, hasItem(isA(FourConstant.class))); assertThat(collection, CollectionMatchers.hasZeroItemsWith("value", is(not(4)))); }
@Test public void failsWhenCollectionIsNullAndPassedAMatcher() { expectAssertionErrorForNullCollection("is not <4>"); assertThat(null, CollectionMatchers.hasZeroItemsWith("value", is(not(4)))); }