title: How to validate in Assertj Collection of Set
body: <p>I have method which returns List of records. Each record have Set as field.</p>
  
  <pre><code>public class R {
      public final Set s;
  }
  </code></pre>
  
  <p>I have list of all expected Set - like:</p>
  
  <pre><code>Set&lt;String&gt; set1 = new HashSet&lt;String&gt;(); set1.add("s1");
  Set&lt;String&gt; set2 = new HashSet&lt;String&gt;(); set1.add("s2");
  Set&lt;String&gt; set3 = new HashSet&lt;String&gt;(); set1.add("s3");
  </code></pre>
  
  <p>I want to validate in easy way using AssertJ (ver. 3.11.1) that response <code>List&lt;R&gt;</code> contains all defined Set or at least aggregation of all elements from these sets are equals to aggregation of elements from sets <code>set1, set2, set3</code></p>
  
  <p><strong>NOTE:</strong> solution bellow is <strong>not</strong> working:</p>
  
  <pre><code>Set allElements = new HashSet&lt;String&gt;();
  allElements.addAll(set1);
  allElements.addAll(set2);
  allElements.addAll(set3);
  
  List&lt;R&gt; result = foo();
  org.assertj.core.api.Assertions.assertThat(result)
      .extracting(record -&gt; record.s)
      .containsOnly(allElements);
  </code></pre>
  
  <p>I got:</p>
  
  <pre><code>java.lang.AssertionError: 
  Expecting:
    &lt;[["s1.1", "s1.2"],
      ["s2.1", "s2.2"],
      ["s3.1", "s3.2"]]&gt;
  to contain only:
    &lt;[["s1.1",
      "s1.2",
      "s2.1",
      "s2.2",
      "s3.1",
      "s3.2"]]&gt;
  </code></pre>