I've just been having a browse through the source code for the version 1 branch and found this:
/**
* Verifies that the actual group of objects does not contain the given objects.
*
* @param objects the objects that the group of objects should exclude.
* @return this assertion object.
* @throws AssertionError if the actual group of objects is {@code null}.
* @throws NullPointerException if the given array is {@code null}.
* @throws AssertionError if the actual group of objects contains any of the given objects.
*/
public final @Nonnull S excludes(@Nonnull Object... objects) {
assertExcludes(objects);
return myself();
}
I probably shouldn't make wild assumptions like this, but it's in the same class as your contains
method (ObjectGroupAssert
) and the Javadoc seems to describe the functionality you're looking for.
So I think, you would just need:
assertThat(list).excludes(5,7);
excludes
is a little surprise to me – Ataxia