Class ShouldContainOnly

java.lang.Object
org.assertj.core.error.BasicErrorMessageFactory
org.assertj.core.error.ShouldContainOnly
All Implemented Interfaces:
ErrorMessageFactory

public class ShouldContainOnly extends BasicErrorMessageFactory
Creates an error message indicating that an assertion that verifies a group of elements contains only a given set of values and nothing else failed. A group of elements can be a collection, an array or a String.
Author:
Alex Ruiz, Yvonne Wang, Joel Costigliola
  • Method Details

    • shouldContainOnly

      public static ErrorMessageFactory shouldContainOnly(Object actual, Object expected, Iterable<?> notFound, Iterable<?> notExpected, org.assertj.core.internal.ComparisonStrategy comparisonStrategy)
      Creates a new ShouldContainOnly.
      Parameters:
      actual - the actual value in the failed assertion.
      expected - values expected to be contained in actual.
      notFound - values in expected not found in actual.
      notExpected - values in actual that were not in expected.
      comparisonStrategy - the ComparisonStrategy used to evaluate assertion.
      Returns:
      the created ErrorMessageFactory.
    • shouldContainOnly

      public static ErrorMessageFactory shouldContainOnly(Object actual, Object expected, Iterable<?> notFound, Iterable<?> notExpected, GroupTypeDescription groupTypeDescription)
    • shouldContainOnly

      public static ErrorMessageFactory shouldContainOnly(Object actual, Object expected, Iterable<?> notFound, Iterable<?> notExpected)
      Creates a new ShouldContainOnly.
      Parameters:
      actual - the actual value in the failed assertion.
      expected - values expected to be contained in actual.
      notFound - values in expected not found in actual.
      notExpected - values in actual that were not in expected.
      Returns:
      the created ErrorMessageFactory.