src/main/java/org/fest/assertions/ItemGroupAssert.java
protected final void assertContainsOnly(@NotNull Object... objects) {
    isNotNull();
    checkNotNull(objects);
    Set<Object> copy = actualAsSet();
    List<Object> notFound = notFoundInCopy(copy, newLinkedHashSet(objects));
    if (!notFound.isEmpty()) {
      throw failureIfExpectedElementsNotFound(notFound);
    }
    if (copy == null || copy.isEmpty()) {
      return;
    }
    throw failureIfUnexpectedElementsFound(copy);
  }
protected final void assertContainsOnly(@NotNull Object... objects) {
    isNotNull();
    checkNotNull(objects);
    Set<Object> copy = actualAsSet();
    List<Object> notFound = notFoundInCopy(copy, newLinkedHashSet(objects));
    if (!notFound.isEmpty()) {
      throw failureIfExpectedElementsNotFound(notFound);
    }
    if (copy == null || copy.isEmpty()) {
      return;
    }
    throw failureIfUnexpectedElementsFound(copy);
  }
protected final void assertContainsOnly ( @ NotNull Object ... objects ) { isNotNull ( ) ; checkNotNull ( objects ) ; Set < Object > copy = actualAsSet ( ) ; List < Object > notFound = notFoundInCopy ( copy , newLinkedHashSet ( objects ) ) ; if ( ! notFound . isEmpty ( ) ) { throw failureIfExpectedElementsNotFound ( notFound ) ; } if ( copy == null || copy . isEmpty ( ) ) { return ; } throw failureIfUnexpectedElementsFound ( copy ) ; }
Verifies that the actual group of objects contains the given objects <strong>only</strong>, in any order.

@param objects the objects to look for.
@throws AssertionError       if the actual group of objects is {@code null}.
@throws NullPointerException if the given group of objects is {@code null}.
@throws AssertionError       if the actual group of objects does not contain the given objects, or if the actual
group of objects contains elements other than the ones specified.
Verifies that the actual group of objects contains the given objects <strong > only< / strong > in any order .