Class ListAssert<ELEMENT>

java.lang.Object
org.assertj.core.api.AbstractAssert<SELF,ACTUAL>
org.assertj.core.api.AbstractIterableAssert<SELF,ACTUAL,ELEMENT,ELEMENT_ASSERT>
org.assertj.core.api.AbstractListAssert<SELF,ACTUAL,ELEMENT,ELEMENT_ASSERT>
org.assertj.core.api.FactoryBasedNavigableListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
org.assertj.core.api.ListAssert<ELEMENT>
Type Parameters:
ELEMENT - the type of elements of the "actual" value.
All Implemented Interfaces:
Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>, Descriptable<ListAssert<ELEMENT>>, EnumerableAssert<ListAssert<ELEMENT>,ELEMENT>, ExtensionPoints<ListAssert<ELEMENT>,List<? extends ELEMENT>>, IndexedObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>, ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>

public class ListAssert<ELEMENT> extends FactoryBasedNavigableListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
Assertion methods for Lists.

To create an instance of this class, invoke Assertions.assertThat(List).

  • Constructor Details

    • ListAssert

      public ListAssert(List<? extends ELEMENT> actual)
    • ListAssert

      public ListAssert(Stream<? extends ELEMENT> actual)
    • ListAssert

      public ListAssert(IntStream actual)
    • ListAssert

      public ListAssert(LongStream actual)
    • ListAssert

      public ListAssert(DoubleStream actual)
  • Method Details

    • newAbstractIterableAssert

      protected ListAssert<ELEMENT> newAbstractIterableAssert(Iterable<? extends ELEMENT> iterable)
      Description copied from class: AbstractIterableAssert
      This methods is needed to build a new concrete instance of AbstractIterableAssert after a filtering operation is executed.

      If you create your own subclass of AbstractIterableAssert, simply returns an instance of it in this method.

      Overrides:
      newAbstractIterableAssert in class FactoryBasedNavigableListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      iterable - the iterable used to build the concrete instance of AbstractIterableAssert
      Returns:
      concrete instance of AbstractIterableAssert
    • isEqualTo

      public ListAssert<ELEMENT> isEqualTo(Object expected)
      Description copied from class: AbstractAssert
      Verifies that the actual value is equal to the given one.

      Example:

       // assertions succeed
       assertThat("abc").isEqualTo("abc");
       assertThat(new HashMap<String, Integer>()).isEqualTo(new HashMap<String, Integer>());
      
       // assertions fail
       assertThat("abc").isEqualTo("123");
       assertThat(new ArrayList<String>()).isEqualTo(1);
      Specified by:
      isEqualTo in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isEqualTo in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      expected - the given value to compare the actual value to.
      Returns:
      this assertion object.
    • isInstanceOf

      public ListAssert<ELEMENT> isInstanceOf(Class<?> type)
      Description copied from class: AbstractAssert
      Verifies that the actual value is an instance of the given type.

      Example:

       // assertions succeed
       assertThat("abc").isInstanceOf(String.class);
       assertThat(new HashMap<String, Integer>()).isInstanceOf(HashMap.class);
       assertThat(new HashMap<String, Integer>()).isInstanceOf(Map.class);
      
       // assertions fail
       assertThat(1).isInstanceOf(String.class);
       assertThat(new ArrayList<String>()).isInstanceOf(LinkedList.class);
      Specified by:
      isInstanceOf in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isInstanceOf in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      type - the type to check the actual value against.
      Returns:
      this assertion object.
    • isInstanceOfAny

      public ListAssert<ELEMENT> isInstanceOfAny(Class<?>... types)
      Description copied from class: AbstractAssert
      Verifies that the actual value is an instance of any of the given types.

      Example:

       // assertions succeed
       assertThat("abc").isInstanceOfAny(String.class, Integer.class);
       assertThat(new ArrayList<String>()).isInstanceOfAny(LinkedList.class, ArrayList.class);
       assertThat(new HashMap<String, Integer>()).isInstanceOfAny(TreeMap.class, Map.class);
      
       // assertions fail
       assertThat(1).isInstanceOfAny(Double.class, Float.class);
       assertThat(new ArrayList<String>()).isInstanceOfAny(LinkedList.class, Vector.class);
      Specified by:
      isInstanceOfAny in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isInstanceOfAny in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      types - the types to check the actual value against.
      Returns:
      this assertion object.
    • isOfAnyClassIn

      public ListAssert<ELEMENT> isOfAnyClassIn(Class<?>... types)
      Description copied from class: AbstractAssert
      Verifies that the actual value type is in given types.

      Example:

       // assertions succeed
       assertThat(new HashMap<String, Integer>()).isOfAnyClassIn(HashMap.class, TreeMap.class);
       assertThat(new ArrayList<String>()).isOfAnyClassIn(ArrayList.class, LinkedList.class);
      
       // assertions fail
       assertThat(new HashMap<String, Integer>()).isOfAnyClassIn(TreeMap.class, Map.class);
       assertThat(new ArrayList<String>()).isOfAnyClassIn(LinkedList.class, List.class);
      Specified by:
      isOfAnyClassIn in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isOfAnyClassIn in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      types - the types to check the actual value against.
      Returns:
      this assertion object.
    • isExactlyInstanceOf

      public ListAssert<ELEMENT> isExactlyInstanceOf(Class<?> type)
      Description copied from class: AbstractAssert
      Verifies that the actual value is exactly an instance of the given type.

      Example:

       // assertions succeed
       assertThat("abc").isExactlyInstanceOf(String.class);
       assertThat(new ArrayList<String>()).isExactlyInstanceOf(ArrayList.class);
       assertThat(new HashMap<String, Integer>()).isExactlyInstanceOf(HashMap.class);
      
       // assertions fail
       assertThat(1).isExactlyInstanceOf(String.class);
       assertThat(new ArrayList<String>()).isExactlyInstanceOf(List.class);
       assertThat(new HashMap<String, Integer>()).isExactlyInstanceOf(Map.class);
      Specified by:
      isExactlyInstanceOf in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isExactlyInstanceOf in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      type - the type to check the actual value against.
      Returns:
      this assertion object.
    • isNotInstanceOf

      public ListAssert<ELEMENT> isNotInstanceOf(Class<?> type)
      Description copied from class: AbstractAssert
      Verifies that the actual value is not an instance of the given type.

      Example:

       // assertions succeed
       assertThat(1).isNotInstanceOf(Double.class);
       assertThat(new ArrayList<String>()).isNotInstanceOf(LinkedList.class);
      
       // assertions fail
       assertThat("abc").isNotInstanceOf(String.class);
       assertThat(new HashMap<String, Integer>()).isNotInstanceOf(HashMap.class);
       assertThat(new HashMap<String, Integer>()).isNotInstanceOf(Map.class);
      Specified by:
      isNotInstanceOf in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isNotInstanceOf in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      type - the type to check the actual value against.
      Returns:
      this assertion object.
    • isNotInstanceOfAny

      public ListAssert<ELEMENT> isNotInstanceOfAny(Class<?>... types)
      Description copied from class: AbstractAssert
      Verifies that the actual value is not an instance of any of the given types.

      Example:

       // assertions succeed
       assertThat(1).isNotInstanceOfAny(Double.class, Float.class);
       assertThat(new ArrayList<String>()).isNotInstanceOfAny(LinkedList.class, Vector.class);
      
       // assertions fail
       assertThat(1).isNotInstanceOfAny(Double.class, Integer.class);
       assertThat(new ArrayList<String>()).isNotInstanceOfAny(LinkedList.class, ArrayList.class);
       assertThat(new HashMap<String, Integer>()).isNotInstanceOfAny(TreeMap.class, Map.class);
      Specified by:
      isNotInstanceOfAny in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isNotInstanceOfAny in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      types - the types to check the actual value against.
      Returns:
      this assertion object.
    • isNotOfAnyClassIn

      public ListAssert<ELEMENT> isNotOfAnyClassIn(Class<?>... types)
      Description copied from class: AbstractAssert
      Verifies that the actual value type is not in given types.

      Example:

       // assertions succeed
       assertThat(new HashMap<String, Integer>()).isNotOfAnyClassIn(Map.class, TreeMap.class);
       assertThat(new ArrayList<String>()).isNotOfAnyClassIn(LinkedList.class, List.class);
      
       // assertions fail
       assertThat(new HashMap<String, Integer>()).isNotOfAnyClassIn(HashMap.class, TreeMap.class);
       assertThat(new ArrayList<String>()).isNotOfAnyClassIn(ArrayList.class, LinkedList.class);
      Specified by:
      isNotOfAnyClassIn in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isNotOfAnyClassIn in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      types - the types to check the actual value against.
      Returns:
      this assertion object.
    • isNotExactlyInstanceOf

      public ListAssert<ELEMENT> isNotExactlyInstanceOf(Class<?> type)
      Description copied from class: AbstractAssert
      Verifies that the actual value is not exactly an instance of given type.

      Example:

       // assertions succeed
       assertThat(1).isNotExactlyInstanceOf(String.class);
       assertThat(new ArrayList<String>()).isNotExactlyInstanceOf(List.class);
       assertThat(new HashMap<String, Integer>()).isNotExactlyInstanceOf(Map.class);
      
       // assertions fail
       assertThat("abc").isNotExactlyInstanceOf(String.class);
       assertThat(new ArrayList<String>()).isNotExactlyInstanceOf(ArrayList.class);
       assertThat(new HashMap<String, Integer>()).isNotExactlyInstanceOf(HashMap.class);
      Specified by:
      isNotExactlyInstanceOf in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isNotExactlyInstanceOf in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      type - the type to check the actual value against.
      Returns:
      this assertion object.
    • isSameAs

      public ListAssert<ELEMENT> isSameAs(Object expected)
      Description copied from class: AbstractAssert
      Verifies that the actual value is the same as the given one, ie using == comparison.

      Example:

       // Name is a class with first and last fields, two Names are equals if both first and last are equals.
       Name tyrion = new Name("Tyrion", "Lannister");
       Name alias  = tyrion;
       Name clone  = new Name("Tyrion", "Lannister");
      
       // assertions succeed:
       assertThat(tyrion).isSameAs(alias)
                         .isEqualTo(clone);
      
       // assertion fails:
       assertThat(tyrion).isSameAs(clone);
      Specified by:
      isSameAs in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isSameAs in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      expected - the given value to compare the actual value to.
      Returns:
      this assertion object.
    • isNotSameAs

      public ListAssert<ELEMENT> isNotSameAs(Object expected)
      Description copied from class: AbstractAssert
      Verifies that the actual value is not the same as the given one, ie using == comparison.

      Example:

       // Name is a class with first and last fields, two Names are equals if both first and last are equals.
       Name tyrion = new Name("Tyrion", "Lannister");
       Name alias  = tyrion;
       Name clone  = new Name("Tyrion", "Lannister");
      
       // assertions succeed:
       assertThat(clone).isNotSameAs(tyrion)
                        .isEqualTo(tyrion);
      
       // assertion fails:
       assertThat(alias).isNotSameAs(tyrion);
      Specified by:
      isNotSameAs in interface Assert<ListAssert<ELEMENT>,List<? extends ELEMENT>>
      Overrides:
      isNotSameAs in class AbstractListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      expected - the given value to compare the actual value to.
      Returns:
      this assertion object.
    • startsWith

      @SafeVarargs public final ListAssert<ELEMENT> startsWith(ELEMENT... sequence)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group starts with the given sequence of objects, without any other objects between them. Similar to ObjectEnumerableAssert.containsSequence(Object...), but it also verifies that the first element in the sequence is also first element of the actual group.

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<String> abc = newArrayList("a", "b", "c");
      
       // assertions will pass
       assertThat(abc).startsWith("a")
                      .startsWith("a", "b");
      
       // assertion will fail
       assertThat(abc).startsWith("c");
      Specified by:
      startsWith in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      startsWith in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      sequence - the sequence of objects to look for.
      Returns:
      this assertion object.
    • actualDoesNotStartWithSequence

      private AssertionError actualDoesNotStartWithSequence(AssertionInfo info, Object[] sequence)
    • asListFromStream

      private ListAssert.ListFromStream asListFromStream()
    • contains

      @SafeVarargs public final ListAssert<ELEMENT> contains(ELEMENT... values)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group contains the given values, in any order.

      Example:

       Iterable<String> abc = newArrayList("a", "b", "c");
      
       // assertions will pass
       assertThat(abc).contains("b", "a");
       assertThat(abc).contains("b", "a", "b");
      
       // assertion will fail
       assertThat(abc).contains("d");

      If you want to specify the elements to check with an Iterable, use containsAll(Iterable) instead.

      Specified by:
      contains in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      contains in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      values - the given values.
      Returns:
      this assertion object.
    • containsOnly

      @SafeVarargs public final ListAssert<ELEMENT> containsOnly(ELEMENT... values)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group contains only the given values and nothing else, in any order and ignoring duplicates (i.e. once a value is found, its duplicates are also considered found).

      If you need to check exactly the elements and their duplicates use:

      Example:

       Iterable<String> abc = newArrayList("a", "b", "c");
      
       // assertions will pass as order does not matter
       assertThat(abc).containsOnly("c", "b", "a");
       // duplicates are ignored
       assertThat(abc).containsOnly("a", "a", "b", "c", "c");
       // ... on both actual and expected values
       assertThat(asList("a", "a", "b")).containsOnly("a", "b")
                                        .containsOnly("a", "a", "b", "b");
      
       // assertion will fail because "c" is missing in the given values
       assertThat(abc).containsOnly("a", "b");
       // assertion will fail because "d" is missing in abc (use isSubsetOf if you want this assertion to pass)
       assertThat(abc).containsOnly("a", "b", "c", "d");

      If you need to check that actual is a subset of the given values, use ObjectEnumerableAssert.isSubsetOf(Object...).

      If you want to specify the elements to check with an Iterable, use containsOnlyElementsOf(Iterable) instead.

      Specified by:
      containsOnly in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      containsOnly in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      values - the given values.
      Returns:
      this assertion object.
    • containsOnlyOnce

      @SafeVarargs public final ListAssert<ELEMENT> containsOnlyOnce(ELEMENT... values)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group contains the given values only once.

      Examples :

       // lists are used in the examples but it would also work with arrays
      
       // assertions will pass
       assertThat(newArrayList("winter", "is", "coming")).containsOnlyOnce("winter");
       assertThat(newArrayList("winter", "is", "coming")).containsOnlyOnce("coming", "winter");
      
       // assertions will fail
       assertThat(newArrayList("winter", "is", "coming")).containsOnlyOnce("Lannister");
       assertThat(newArrayList("Arya", "Stark", "daughter", "of", "Ned", "Stark")).containsOnlyOnce("Stark");
       assertThat(newArrayList("Arya", "Stark", "daughter", "of", "Ned", "Stark")).containsOnlyOnce("Stark", "Lannister", "Arya");
      Specified by:
      containsOnlyOnce in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      containsOnlyOnce in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      values - the given values.
      Returns:
      this assertion object.
    • containsExactly

      @SafeVarargs public final ListAssert<ELEMENT> containsExactly(ELEMENT... values)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group contains exactly the given values and nothing else, in order.
      This assertion should only be used with groups that have a consistent iteration order (i.e. don't use it with HashSet, prefer ObjectEnumerableAssert.containsOnly(Object...) in that case).

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya);
      
       // assertion will pass
       assertThat(elvesRings).containsExactly(vilya, nenya, narya);
      
       // assertion will fail as actual and expected order differ
       assertThat(elvesRings).containsExactly(nenya, vilya, narya);

      If you want to specify the elements to check with an Iterable, use containsExactlyElementsOf(Iterable) instead.

      Specified by:
      containsExactly in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      containsExactly in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      values - the given values.
      Returns:
      this assertion object.
    • containsExactlyInAnyOrder

      @SafeVarargs public final ListAssert<ELEMENT> containsExactlyInAnyOrder(ELEMENT... values)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group contains exactly the given values and nothing else, in any order.

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya, vilya);
      
       // assertion will pass
       assertThat(elvesRings).containsExactlyInAnyOrder(vilya, vilya, nenya, narya);
      
       // assertion will fail as vilya is contained twice in elvesRings.
       assertThat(elvesRings).containsExactlyInAnyOrder(nenya, vilya, narya);

      If you want to specify the elements to check with an Iterable, use containsExactlyInAnyOrderElementsOf(Iterable) instead.

      Specified by:
      containsExactlyInAnyOrder in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      containsExactlyInAnyOrder in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      values - the given values.
      Returns:
      this assertion object.
    • containsAnyOf

      @SafeVarargs public final ListAssert<ELEMENT> containsAnyOf(ELEMENT... values)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual Iterable contains at least one of the given values.

      Example:

       Iterable<String> abc = Arrays.asList("a", "b", "c");
      
       // assertions will pass
       assertThat(abc).containsAnyOf("b")
                      .containsAnyOf("b", "c")
                      .containsAnyOf("a", "b", "c")
                      .containsAnyOf("a", "b", "c", "d")
                      .containsAnyOf("e", "f", "g", "b");
      
       // assertions will fail
       assertThat(abc).containsAnyOf("d");
       assertThat(abc).containsAnyOf("d", "e", "f", "g");
      Specified by:
      containsAnyOf in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      containsAnyOf in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      values - the values whose at least one which is expected to be in the Iterable under test.
      Returns:
      this assertion object.
    • isSubsetOf

      @SafeVarargs public final ListAssert<ELEMENT> isSubsetOf(ELEMENT... values)
      Description copied from class: AbstractIterableAssert
      Verifies that all the elements of actual are present in the given values.

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya);
      
       // assertions will pass:
       assertThat(elvesRings).isSubsetOf(vilya, nenya, narya)
                             .isSubsetOf(vilya, nenya, narya, dwarfRing);
      
       // assertions will fail:
       assertThat(elvesRings).isSubsetOf(vilya, nenya);
       assertThat(elvesRings).isSubsetOf(vilya, nenya, dwarfRing);

      If you want to specify the set of elements an Iterable, use isSubsetOf(Iterable) instead.

      Specified by:
      isSubsetOf in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      isSubsetOf in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      values - the values that should be used for checking the elements of actual.
      Returns:
      this assertion object.
    • containsSequence

      @SafeVarargs public final ListAssert<ELEMENT> containsSequence(ELEMENT... sequence)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group contains the given sequence in the correct order and without extra values between the sequence values.

      Use ObjectEnumerableAssert.containsSubsequence(Object...) to allow values between the expected sequence values.

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya);
      
       // assertions will pass
       assertThat(elvesRings).containsSequence(vilya, nenya)
                             .containsSequence(nenya, narya);
      
       // assertions will fail, the elements order is correct but there is a value between them (nenya)
       assertThat(elvesRings).containsSequence(vilya, narya);
       assertThat(elvesRings).containsSequence(nenya, vilya);

      If you want to specify the sequence to check with an Iterable, use containsSequence(Iterable) instead.

      Specified by:
      containsSequence in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      containsSequence in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      sequence - the sequence of objects to look for.
      Returns:
      this assertion object.
    • doesNotContainSequence

      @SafeVarargs public final ListAssert<ELEMENT> doesNotContainSequence(ELEMENT... sequence)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group does not contain the given sequence, a sequence is defined by an ordered group of values without extra values between them.

      Use ObjectEnumerableAssert.doesNotContainSubsequence(Object...) to also ensure the sequence does not exist with values between the expected sequence values.

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya);
      
       // assertions will pass, the elements order is correct but there is a value between them (nenya)
       assertThat(elvesRings).doesNotContainSequence(vilya, narya)
                             .doesNotContainSequence(nenya, vilya);
      
       // assertions will fail
       assertThat(elvesRings).doesNotContainSequence(vilya, nenya);
       assertThat(elvesRings).doesNotContainSequence(nenya, narya);

      If you want to specify the sequence not to find with an Iterable, use doesNotContainSequence(Iterable) instead.

      Specified by:
      doesNotContainSequence in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      doesNotContainSequence in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      sequence - the sequence of objects to look for.
      Returns:
      this assertion object.
    • containsSubsequence

      @SafeVarargs public final ListAssert<ELEMENT> containsSubsequence(ELEMENT... sequence)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group contains the given subsequence in the correct order (possibly with other values between them).

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya);
      
       // assertions will pass
       assertThat(elvesRings).containsSubsequence(vilya, nenya)
                             .containsSubsequence(vilya, narya);
      
       // assertion will fail
       assertThat(elvesRings).containsSubsequence(nenya, vilya);

      If you want to specify the elements of the subsequence to check with an Iterable, use containsSubsequence(Iterable) instead.

      Specified by:
      containsSubsequence in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      containsSubsequence in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      sequence - the sequence of objects to look for.
      Returns:
      this assertion object.
    • doesNotContainSubsequence

      @SafeVarargs public final ListAssert<ELEMENT> doesNotContainSubsequence(ELEMENT... sequence)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group does not contain the given subsequence, a subsequence is defined by an ordered group of values with possibly extra values between them.

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<Ring> elvesRings = newArrayList(vilya, nenya, narya);
      
       // assertions will pass
       assertThat(elvesRings).doesNotContainSubsequence(nenya, vilya)
                             .doesNotContainSubsequence(narya, vilya);
      
       // assertion will fail
       assertThat(elvesRings).doesNotContainSubsequence(vilya, nenya);
       assertThat(elvesRings).doesNotContainSubsequence(vilya, narya);

      If you want to specify the subsequence not to find with an Iterable, use doesNotContainSubsequence(Iterable) instead.

      Specified by:
      doesNotContainSubsequence in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      doesNotContainSubsequence in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      sequence - the sequence of objects to look for.
      Returns:
      this assertion object.
    • doesNotContain

      @SafeVarargs public final ListAssert<ELEMENT> doesNotContain(ELEMENT... values)
      Description copied from interface: ObjectEnumerableAssert
      Verifies that the actual group does not contain the given values.

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<String> abc = newArrayList("a", "b", "c");
      
       // assertions will pass
       assertThat(abc).doesNotContain("d")
                      .doesNotContain("d", "e");
      
       // assertions will fail
       assertThat(abc).doesNotContain("a");
       assertThat(abc).doesNotContain("a", "b");
       assertThat(abc).doesNotContain("c", "d");

      If you want to specify the elements not to find with an Iterable, use doesNotContainAnyElementsOf(Iterable) instead.

      Specified by:
      doesNotContain in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      doesNotContain in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      values - the given values.
      Returns:
      this assertion object.
    • endsWith

      @SafeVarargs public final ListAssert<ELEMENT> endsWith(ELEMENT first, ELEMENT... rest)
      Description copied from class: AbstractIterableAssert
      Verifies that the actual group ends with the given sequence of objects, without any other objects between them. Similar to ObjectEnumerableAssert.containsSequence(Object...), but it also verifies that the last element in the sequence is also last element of the actual group.

      Example:

       // an Iterable is used in the example but it would also work with an array
       Iterable<String> abc = newArrayList("a", "b", "c");
      
       // assertions will pass
       assertThat(abc).endsWith("c")
                      .endsWith("b", "c");
      
       // assertions will fail
       assertThat(abc).endsWith("a");
       assertThat(abc).endsWith("a", "b");
      Specified by:
      endsWith in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      endsWith in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      first - the first element of the sequence of objects to look for.
      rest - the rest of the sequence of objects to look for.
      Returns:
      this assertion object.
    • extracting

      @SafeVarargs public final AbstractListAssert<?,List<? extends Tuple>,Tuple,ObjectAssert<Tuple>> extracting(Function<? super ELEMENT,?>... extractors)
      Description copied from class: AbstractIterableAssert
      Use the given Functions to extract the values from the Iterable's elements into a new Iterable composed of Tuples (a simple data structure containing the extracted values), this new Iterable becoming the object under test.

      It allows you to test values from the Iterable's elements instead of testing the elements themselves, which sometimes can be much less work!

      The Tuple data correspond to the extracted values from the Iterable's elements, for instance if you pass functions extracting "id", "name" and "email" values then each Tuple data will be composed of an id, a name and an email extracted from the element of the initial Iterable (the Tuple's data order is the same as the given functions order).

      Let's take a look at an example to make things clearer:

       // Build a list of TolkienCharacter, a TolkienCharacter has a name, and age and a Race (a specific class)
       // they can be public field or properties, both can be extracted.
       List<TolkienCharacter> fellowshipOfTheRing = new ArrayList<TolkienCharacter>();
      
       fellowshipOfTheRing.add(new TolkienCharacter("Frodo", 33, HOBBIT));
       fellowshipOfTheRing.add(new TolkienCharacter("Sam", 38, HOBBIT));
       fellowshipOfTheRing.add(new TolkienCharacter("Gandalf", 2020, MAIA));
       fellowshipOfTheRing.add(new TolkienCharacter("Legolas", 1000, ELF));
       fellowshipOfTheRing.add(new TolkienCharacter("Pippin", 28, HOBBIT));
       fellowshipOfTheRing.add(new TolkienCharacter("Gimli", 139, DWARF));
       fellowshipOfTheRing.add(new TolkienCharacter("Aragorn", 87, MAN);
       fellowshipOfTheRing.add(new TolkienCharacter("Boromir", 37, MAN));
      
       // let's verify 'name', 'age' and Race of some TolkienCharacter in fellowshipOfTheRing:
       assertThat(fellowshipOfTheRing).extracting(TolkienCharacter::getName,
                                                  character -> character.getAge(),
                                                  TolkienCharacter::getRace)
                                      .containsOnly(tuple("Frodo", 33, HOBBIT),
                                                    tuple("Sam", 38, HOBBIT),
                                                    tuple("Gandalf", 2020, MAIA),
                                                    tuple("Legolas", 1000, ELF),
                                                    tuple("Pippin", 28, HOBBIT),
                                                    tuple("Gimli", 139, DWARF),
                                                    tuple("Aragorn", 87, MAN),
                                                    tuple("Boromir", 37, MAN));
      You can use lambda expression or a method reference to extract the expected values.

      Use Tuple.tuple(Object...) to initialize the expected values.

      Note that the order of the extracted tuples list is consistent with the iteration order of the Iterable under test, for example if it's a HashSet, you won't be able to make any assumptions on the extracted tuples order.

      Overrides:
      extracting in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      extractors - the extractor functions to extract a value from an element of the Iterable under test.
      Returns:
      a new assertion object whose object under test is the list of Tuples containing the extracted values.
    • map

      @SafeVarargs public final AbstractListAssert<?,List<? extends Tuple>,Tuple,ObjectAssert<Tuple>> map(Function<? super ELEMENT,?>... mappers)
      Description copied from class: AbstractIterableAssert
      Use the given Functions to map the Iterable's elements into a List of Tuples (a simple data structure containing the mapped values), this new list becoming the object under test.

      This allows you to test values from the Iterable's elements instead of testing the elements themselves, which sometimes can be much less work!

      The Tuple data correspond to the extracted values from the Iterable's elements, for instance if you pass functions mapping "id", "name" and "email" values then each Tuple data will be composed of an id, a name and an email mapped from the element of the initial Iterable (the Tuple's data order is the same as the given functions order).

      Let's take a look at an example to make things clearer:

       // Build a list of TolkienCharacter, a TolkienCharacter has a name, and age and a Race (a specific class)
       // they can be public field or properties, both can be extracted.
       List<TolkienCharacter> fellowshipOfTheRing = new ArrayList<TolkienCharacter>();
      
       fellowshipOfTheRing.add(new TolkienCharacter("Frodo", 33, HOBBIT));
       fellowshipOfTheRing.add(new TolkienCharacter("Sam", 38, HOBBIT));
       fellowshipOfTheRing.add(new TolkienCharacter("Gandalf", 2020, MAIA));
       fellowshipOfTheRing.add(new TolkienCharacter("Legolas", 1000, ELF));
       fellowshipOfTheRing.add(new TolkienCharacter("Pippin", 28, HOBBIT));
       fellowshipOfTheRing.add(new TolkienCharacter("Gimli", 139, DWARF));
       fellowshipOfTheRing.add(new TolkienCharacter("Aragorn", 87, MAN);
       fellowshipOfTheRing.add(new TolkienCharacter("Boromir", 37, MAN));
      
       // let's verify 'name', 'age' and Race of some TolkienCharacter in fellowshipOfTheRing:
       assertThat(fellowshipOfTheRing).map(TolkienCharacter::getName,
                                           character -> character.getAge(),
                                           TolkienCharacter::getRace)
                                      .containsOnly(tuple("Frodo", 33, HOBBIT),
                                                    tuple("Sam", 38, HOBBIT),
                                                    tuple("Gandalf", 2020, MAIA),
                                                    tuple("Legolas", 1000, ELF),
                                                    tuple("Pippin", 28, HOBBIT),
                                                    tuple("Gimli", 139, DWARF),
                                                    tuple("Aragorn", 87, MAN),
                                                    tuple("Boromir", 37, MAN));
      You can use lambda expression or a method reference to extract the expected values.

      Use Tuple.tuple(Object...) to initialize the expected values.

      Note that the order of the extracted tuples list is consistent with the iteration order of the Iterable under test, for example if it's a HashSet, you won't be able to make any assumptions on the extracted tuples order.

      Overrides:
      map in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      mappers - the mapper functions to extract a value from an element of the Iterable under test.
      Returns:
      a new assertion object whose object under test is the list of Tuples containing the extracted values.
    • flatExtracting

      @SafeVarargs public final <EXCEPTION extends Exception> AbstractListAssert<?,List<?>,Object,ObjectAssert<Object>> flatExtracting(ThrowingExtractor<? super ELEMENT,?,EXCEPTION>... extractors)
      Description copied from class: AbstractIterableAssert
      Extracts multiple values from each Iterable's element according to the given ThrowingExtractors and concatenates/flattens them in a list that becomes the object under test.

      If extracted values were not flattened, instead of a simple list like (given 2 extractors):

        element1.value1, element1.value2, element2.value1, element2.value2, ...  
      we would get a list of list like:
        list(element1.value1, element1.value2), list(element2.value1, element2.value2), ...  

      Example:

       // fellowshipOfTheRing is a List<TolkienCharacter>
      
       // values are extracted in order and flattened: age1, name1, age2, name2, age3 ...
       assertThat(fellowshipOfTheRing).flatExtracting(input -> {
         if (input.getAge() < 20) {
           throw new Exception("age < 20");
         }
         return input.getName();
       }, input2 -> {
         if (input2.getAge() < 20) {
           throw new Exception("age < 20");
         }
         return input2.getAge();
       }).contains(33 ,"Frodo",
           1000, "Legolas",
           87, "Aragorn");
      The resulting extracted values list is ordered by Iterable's element first and then extracted values, this is why is in the example age values come before names.
      Overrides:
      flatExtracting in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Type Parameters:
      EXCEPTION - the exception type of ThrowingExtractor
      Parameters:
      extractors - all the extractors to apply on each actual Iterable's elements
      Returns:
      a new assertion object whose object under test is a flattened list of all extracted values.
    • flatMap

      @SafeVarargs public final <EXCEPTION extends Exception> AbstractListAssert<?,List<? extends Object>,Object,ObjectAssert<Object>> flatMap(ThrowingExtractor<? super ELEMENT,?,EXCEPTION>... mappers)
      Description copied from class: AbstractIterableAssert
      Maps multiple values from each Iterable's element according to the given ThrowingExtractors and concatenates/flattens them in a list that becomes the object under test.

      If mapped values were not flattened, instead of a simple list like (given 2 mappers):

        element1.value1, element1.value2, element2.value1, element2.value2, ...  
      we would get a list of list like:
        list(element1.value1, element1.value2), list(element2.value1, element2.value2), ...  

      Example:

       // fellowshipOfTheRing is a List<TolkienCharacter>
      
       // values are extracted in order and flattened: age1, name1, age2, name2, age3 ...
       assertThat(fellowshipOfTheRing).flatMap(input -> {
         if (input.getAge() < 20) {
           throw new Exception("age < 20");
         }
         return input.getName();
       }, input2 -> {
         if (input2.getAge() < 20) {
           throw new Exception("age < 20");
         }
         return input2.getAge();
       }).contains(33 ,"Frodo",
           1000, "Legolas",
           87, "Aragorn");
      The resulting mapped values list is ordered by Iterable's element first and then mapped values, this is why is in the example age values come before names.
      Overrides:
      flatMap in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Type Parameters:
      EXCEPTION - the exception type of ThrowingExtractor
      Parameters:
      mappers - all the mappers to apply on each actual Iterable's elements
      Returns:
      a new assertion object whose object under test is a flattened list of all extracted values.
    • flatExtracting

      @SafeVarargs public final AbstractListAssert<?,List<?>,Object,ObjectAssert<Object>> flatExtracting(Function<? super ELEMENT,?>... extractors)
      Description copied from class: AbstractIterableAssert
      Extracts multiple values from each Iterable's element according to the given Functions and concatenates/flattens them in a list that becomes the instance under test.

      If extracted values were not flattened, instead of a simple list like (given 2 extractors):

        element1.value1, element1.value2, element2.value1, element2.value2, ...  
      we would get a list of list like:
        list(element1.value1, element1.value2), list(element2.value1, element2.value2), ...  

      Example:

       // fellowshipOfTheRing is a List<TolkienCharacter>
      
       // values are extracted in order and flattened: age1, name1, age2, name2, age3 ...
       assertThat(fellowshipOfTheRing).flatExtracting(TolkienCharacter::getAge,
                                                      TolkienCharacter::getName)
                                      .contains(33 ,"Frodo",
                                                1000, "Legolas",
                                                87, "Aragorn");
      The resulting extracted values list is ordered by Iterable's element first and then extracted values, this is why is in the example age values come before names.
      Overrides:
      flatExtracting in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      extractors - all the extractors to apply on each actual Iterable's elements
      Returns:
      a new assertion object whose object under test is a flattened list of all extracted values.
    • flatMap

      @SafeVarargs public final AbstractListAssert<?,List<? extends Object>,Object,ObjectAssert<Object>> flatMap(Function<? super ELEMENT,?>... mappers)
      Description copied from class: AbstractIterableAssert
      Maps multiple values from each Iterable's element according to the given Functions and concatenates/flattens them in a list that becomes the instance under test.

      If mapped values were not flattened, instead of a simple list like (given 2 extractors):

        element1.value1, element1.value2, element2.value1, element2.value2, ...  
      we would get a list of list like:
        list(element1.value1, element1.value2), list(element2.value1, element2.value2), ...  

      Example:

       // fellowshipOfTheRing is a List<TolkienCharacter>
      
       // values are extracted in order and flattened: age1, name1, age2, name2, age3 ...
       assertThat(fellowshipOfTheRing).flatMap(TolkienCharacter::getAge,
                                               TolkienCharacter::getName)
                                      .contains(33 ,"Frodo",
                                                1000, "Legolas",
                                                87, "Aragorn");
      The resulting mapped values list is ordered by Iterable's element first and then mapped values, this is why is in the example age values come before names.
      Overrides:
      flatMap in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      mappers - all the mappers to apply on each actual Iterable's elements
      Returns:
      a new assertion object whose object under test is a flattened list of all mapped values.
    • satisfiesExactly

      @SafeVarargs public final ListAssert<ELEMENT> satisfiesExactly(Consumer<? super ELEMENT>... requirements)
      Description copied from interface: ObjectEnumerableAssert
      Verifies that each element satisfies the requirements corresponding to its index, so the first element must satisfy the first requirements, the second element the second requirements etc...

      Each requirements are expressed as a Consumer, there must be as many requirements as there are iterable elements.

      Example:

       Iterable<TolkienCharater> characters = list(frodo, aragorn, legolas);
      
       // assertions succeed
       assertThat(characters).satisfiesExactly(character -> assertThat(character.getRace()).isEqualTo("Hobbit"),
                                               character -> assertThat(character.isMortal()).isTrue(),
                                               character -> assertThat(character.getName()).isEqualTo("Legolas"));
      
       // you can specify more that one assertion per requirements
       assertThat(characters).satisfiesExactly(character -> {
                                                  assertThat(character.getRace()).isEqualTo("Hobbit");
                                                  assertThat(character.getName()).isEqualTo("Frodo");
                                               },
                                               character -> {
                                                  assertThat(character.isMortal()).isTrue();
                                                  assertThat(character.getName()).isEqualTo("Aragorn");
                                               },
                                               character -> {
                                                  assertThat(character.getRace()).isEqualTo("Elf");
                                                  assertThat(character.getName()).isEqualTo("Legolas");
                                               });
      
       // assertion fails as aragorn does not meet the second requirements
       assertThat(characters).satisfiesExactly(character -> assertThat(character.getRace()).isEqualTo("Hobbit"),
                                               character -> assertThat(character.isMortal()).isFalse(),
                                               character -> assertThat(character.getName()).isEqualTo("Legolas"));
      Specified by:
      satisfiesExactly in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      satisfiesExactly in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      requirements - the requirements to meet.
      Returns:
      this to chain assertions.
    • satisfiesExactlyInAnyOrder

      @SafeVarargs public final ListAssert<ELEMENT> satisfiesExactlyInAnyOrder(Consumer<? super ELEMENT>... requirements)
      Description copied from interface: ObjectEnumerableAssert
      Verifies that at least one combination of iterable elements exists that satisfies the consumers in order (there must be as many consumers as iterable elements and once a consumer is matched it cannot be reused to match other elements).

      This is a variation of ObjectEnumerableAssert.satisfiesExactly(Consumer...) where order does not matter.

      Examples:

       List<String> starWarsCharacterNames = list("Luke", "Leia", "Yoda");
      
       // these assertions succeed:
       assertThat(starWarsCharacterNames).satisfiesExactlyInAnyOrder(name -> assertThat(name).contains("Y"), // matches "Yoda"
                                                                     name -> assertThat(name).contains("L"), // matches "Luke" and "Leia"
                                                                     name -> {
                                                                       assertThat(name).hasSize(4);
                                                                       assertThat(name).doesNotContain("a"); // matches "Luke" but not "Leia"
                                                                     })
                                         .satisfiesExactlyInAnyOrder(name -> assertThat(name).contains("Yo"),
                                                                     name -> assertThat(name).contains("Lu"),
                                                                     name -> assertThat(name).contains("Le"))
                                         .satisfiesExactlyInAnyOrder(name -> assertThat(name).contains("Le"),
                                                                     name -> assertThat(name).contains("Yo"),
                                                                     name -> assertThat(name).contains("Lu"));
      
       // this assertion fails as 3 consumer/requirements are expected
       assertThat(starWarsCharacterNames).satisfiesExactlyInAnyOrder(name -> assertThat(name).contains("Y"),
                                                                     name -> assertThat(name).contains("L"));
      
       // this assertion fails as no element contains "Han" (first consumer/requirements can't be met)
       assertThat(starWarsCharacterNames).satisfiesExactlyInAnyOrder(name -> assertThat(name).contains("Han"),
                                                                     name -> assertThat(name).contains("L"),
                                                                     name -> assertThat(name).contains("Y"));
      
       // this assertion fails as "Yoda" element can't satisfy any consumers/requirements (even though all consumers/requirements are met)
       assertThat(starWarsCharacterNames).satisfiesExactlyInAnyOrder(name -> assertThat(name).contains("L"),
                                                                     name -> assertThat(name).contains("L"),
                                                                     name -> assertThat(name).contains("L"));
      
       // this assertion fails as no combination of elements can satisfy the consumers in order
       // the problem is if the last consumer is matched by Leia then no other consumer can match Luke (and vice versa)
       assertThat(starWarsCharacterNames).satisfiesExactlyInAnyOrder(name -> assertThat(name).contains("Y"),
                                                                     name -> assertThat(name).contains("o"),
                                                                     name -> assertThat(name).contains("L"));
      Specified by:
      satisfiesExactlyInAnyOrder in interface ObjectEnumerableAssert<ListAssert<ELEMENT>,ELEMENT>
      Overrides:
      satisfiesExactlyInAnyOrder in class AbstractIterableAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>>
      Parameters:
      requirements - the consumers that are expected to be satisfied by the elements of the given Iterable.
      Returns:
      this assertion object.