@Test @SuppressWarnings("unchecked") public void testNoMatchSize() throws Exception { assertThat(new CollectionOneToOneMatcher<Object>(Arrays.asList(firstMatcher, secondMatcher)).matches(Collections.singletonList(firstMatcher)), is(false)); verifyZeroInteractions(firstMatcher); verifyZeroInteractions(secondMatcher); }
public boolean matches(Iterable<? extends T> target) { if ((target instanceof Collection) && ((Collection<?>) target).size() != matchers.size()) { return false; } Iterator<? extends ElementMatcher<? super T>> iterator = matchers.iterator(); for (T value : target) { if (!iterator.hasNext() || !iterator.next().matches(value)) { return false; } } return true; }
CollectionOneToOneMatcher extends ElementMatcher.Junction.AbstractBase<Iterable<? extends T>> { public boolean matches(Iterable<? extends T> target) { if ((target instanceof Collection) && ((Collection<?>) target).size() != matchers.size()) { return false; } Iterator<? extends ElementMatcher<? super T>> iterator = matchers.iterator(); for (T value : target) { if (!iterator.hasNext() || !iterator.next().matches(value)) { return false; } } return true; } }
CollectionOneToOneMatcher extends ElementMatcher.Junction.AbstractBase<Iterable<? extends T>> { public boolean matches(Iterable<? extends T> target) { if ((target instanceof Collection) && ((Collection<?>) target).size() != matchers.size()) { return false; } Iterator<? extends ElementMatcher<? super T>> iterator = matchers.iterator(); for (T value : target) { if (!iterator.hasNext() || !iterator.next().matches(value)) { return false; } } return true; } CollectionOneToOneMatcher(List<? extends ElementMatcher<? super T>> matchers); }
CollectionOneToOneMatcher extends ElementMatcher.Junction.AbstractBase<Iterable<? extends T>> { public boolean matches(Iterable<? extends T> target) { if ((target instanceof Collection) && ((Collection<?>) target).size() != matchers.size()) { return false; } Iterator<? extends ElementMatcher<? super T>> iterator = matchers.iterator(); for (T value : target) { if (!iterator.hasNext() || !iterator.next().matches(value)) { return false; } } return true; } CollectionOneToOneMatcher(List<? extends ElementMatcher<? super T>> matchers); boolean matches(Iterable<? extends T> target); @Override String toString(); }
CollectionOneToOneMatcher extends ElementMatcher.Junction.AbstractBase<Iterable<? extends T>> { public boolean matches(Iterable<? extends T> target) { if ((target instanceof Collection) && ((Collection<?>) target).size() != matchers.size()) { return false; } Iterator<? extends ElementMatcher<? super T>> iterator = matchers.iterator(); for (T value : target) { if (!iterator.hasNext() || !iterator.next().matches(value)) { return false; } } return true; } CollectionOneToOneMatcher(List<? extends ElementMatcher<? super T>> matchers); boolean matches(Iterable<? extends T> target); @Override String toString();  }