Пример #1
0
  @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))));
  }
Пример #2
0
  @Theory
  public void succeedsWhenCollectionContainsZeroItemsMatchingMatcher(
      Collection<Object> collection) {
    assumeThat(collection, hasItem(isA(FourConstant.class)));

    assertThat(collection, CollectionMatchers.hasZeroItemsWith("value", is(not(4))));
  }
Пример #3
0
  @Test
  public void failsWhenCollectionIsNullAndPassedAMatcher() {
    expectAssertionErrorForNullCollection("is not <4>");

    assertThat(null, CollectionMatchers.hasZeroItemsWith("value", is(not(4))));
  }