public <T> void assertDoesNotContainAnyElementsOf(AssertionInfo info, Object[] actual, Iterable<? extends T> iterable) { checkIsNotNullAndNotEmpty(iterable); List<T> values = newArrayList(iterable); assertDoesNotContain(info, actual, values.toArray()); }
/** * Asserts that the given {@code Iterable} does not contain the given values. * * @param <T> the type of actual elements * @param info contains information about the assertion. * @param actual the given {@code Iterable}. * @param iterable the values that are expected not to be in the given {@code Iterable}. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given {@code Iterable} is {@code null}. * @throws AssertionError if the given {@code Iterable} contains any of given values. */ public <T> void assertDoesNotContainAnyElementsOf(AssertionInfo info, Iterable<? extends T> actual, Iterable<? extends T> iterable) { checkIsNotNullAndNotEmpty(iterable); List<T> values = newArrayList(iterable); assertDoesNotContain(info, actual, values.toArray()); }
public <T> void assertDoesNotContainAnyElementsOf(AssertionInfo info, Object[] actual, Iterable<? extends T> iterable) { checkIsNotNullAndNotEmpty(iterable); List<T> values = newArrayList(iterable); assertDoesNotContain(info, actual, values.toArray()); }
/** * Asserts that the given {@code Iterable} does not contain the given values. * * @param <T> the type of actual elements * @param info contains information about the assertion. * @param actual the given {@code Iterable}. * @param iterable the values that are expected not to be in the given {@code Iterable}. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given {@code Iterable} is {@code null}. * @throws AssertionError if the given {@code Iterable} contains any of given values. */ public <T> void assertDoesNotContainAnyElementsOf(AssertionInfo info, Iterable<? extends T> actual, Iterable<? extends T> iterable) { checkIsNotNullAndNotEmpty(iterable); List<T> values = newArrayList(iterable); assertDoesNotContain(info, actual, values.toArray()); }
/** * Asserts that the given {@code Iterable} does not contain the given values. * * @param info contains information about the assertion. * @param actual the given {@code Iterable}. * @param values the values that are expected not to be in the given {@code Iterable}. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given {@code Iterable} is {@code null}. * @throws AssertionError if the given {@code Iterable} contains any of given values. */ public void assertDoesNotContain(AssertionInfo info, Iterable<?> actual, Object[] values) { checkIsNotNullAndNotEmpty(values); assertNotNull(info, actual); Set<Object> found = new LinkedHashSet<>(); for (Object o : values) { if (iterableContains(actual, o)) found.add(o); } if (!found.isEmpty()) throw failures.failure(info, shouldNotContain(actual, values, found, comparisonStrategy)); }
/** * Asserts that the given {@code Iterable} does not contain the given values. * * @param info contains information about the assertion. * @param actual the given {@code Iterable}. * @param values the values that are expected not to be in the given {@code Iterable}. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given {@code Iterable} is {@code null}. * @throws AssertionError if the given {@code Iterable} contains any of given values. */ public void assertDoesNotContain(AssertionInfo info, Iterable<?> actual, Object[] values) { checkIsNotNullAndNotEmpty(values); assertNotNull(info, actual); Set<Object> found = new LinkedHashSet<>(); for (Object o : values) { if (iterableContains(actual, o)) found.add(o); } if (!found.isEmpty()) throw failures.failure(info, shouldNotContain(actual, values, found, comparisonStrategy)); }
/** * Asserts that the given {@code Iterable} does not contain the given values. * * @param info contains information about the assertion. * @param actual the given {@code Iterable}. * @param iterable the values that are expected not to be in the given {@code Iterable}. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given {@code Iterable} is {@code null}. * @throws AssertionError if the given {@code Iterable} contains any of given values. */ public <T> void assertDoesNotContainAnyElementsOf(AssertionInfo info, Iterable<? extends T> actual, Iterable<? extends T> iterable) { checkIsNotNullAndNotEmpty(iterable); List<T> values = newArrayList(iterable); assertDoesNotContain(info, actual, values.toArray()); }
/** * Asserts that the given {@code Iterable} does not contain the given values. * * @param info contains information about the assertion. * @param actual the given {@code Iterable}. * @param values the values that are expected not to be in the given {@code Iterable}. * @throws NullPointerException if the array of values is {@code null}. * @throws IllegalArgumentException if the array of values is empty. * @throws AssertionError if the given {@code Iterable} is {@code null}. * @throws AssertionError if the given {@code Iterable} contains any of given values. */ public void assertDoesNotContain(AssertionInfo info, Iterable<?> actual, Object[] values) { checkIsNotNullAndNotEmpty(values); assertNotNull(info, actual); Set<Object> found = new LinkedHashSet<Object>(); for (Object o : values) { if (iterableContains(actual, o)) { found.add(o); } } if (found.isEmpty()) { return; } throw failures.failure(info, shouldNotContain(actual, values, found, comparisonStrategy)); }