title: AssertJ `containsExactly` assertion on list with wildcard
body: <p>I have a getter returning a List with a wildcard:</p>
  
  <pre><code>import java.util.List;
  
  public interface Foo {
      List&lt;? extends Bar&gt; getList();
  }
  </code></pre>
  
  <p>Where <code>Bar</code> is an other interface.</p>
  
  <p>When I write an assertion with AssertJ like this:</p>
  
  <pre><code>assertThat(foo.getList()).containsExactly(bar1, bar3);
  </code></pre>
  
  <p>EDIT: my complete usage is to chain a <code>usingElementComparator</code> and to provide a <code>Comparator&lt;Bar&gt;</code> to compare the expected <code>Bar</code> instances.</p>
  
  <pre><code>Comparator&lt;Bar&gt; comparator = createBarComparator()
  assertThat(foo.getList()).usingElementComparator(comparator).containsExactly(bar1, bar3);
  </code></pre>
  
  <p>I get this compilation error:</p>
  
  <blockquote>
    <p>The method containsExactly(capture#46-of ? extends Bar...) in the type ListAssert is not applicable for the arguments (Bar, Bar)</p>
  </blockquote>
  
  <hr>
  
  <p>My first solution is to cast the result:</p>
  
  <pre><code>assertThat((List&lt;Bar&gt;)foo.getList()).containsExactly(bar1, bar3);
  </code></pre>
  
  <p>Then I get a warning:</p>
  
  <blockquote>
    <p>Type safety: Unchecked cast from List to List</p>
  </blockquote>
  
  <p>Warning can be removed with <code>@SuppressWarnings("unchecked")</code>, but still the cast in the middle do not make the assertion really readable.</p>
  
  <hr>
  
  <p>My second solution is to indicate the value the ELEMENT generic parameter:</p>
  
  <pre><code>Assertions.&lt;Bar&gt;assertThat(foo.getList()).containsExactly(bar1, bar3);
  </code></pre>
  
  <p>A little better, but also not that nice (no static import possible, the beginning of the line do not facilitate the readability)</p>
  
  <hr>
  
  <p>I guess I am looking for an other <code>assertThat</code> method for list, where the class type can be specified as second parameter:</p>
  
  <pre><code>@CheckReturnValue
  public static &lt;ELEMENT&gt; ListAssert&lt;ELEMENT&gt; assertThat(List&lt;? extends ELEMENT&gt; actual, Class&lt;ELEMENT&gt; c) {
      return AssertionsForInterfaceTypes.assertThat(actual);
  }
  </code></pre>
  
  <p>This way I should be able to write something like this:</p>
  
  <pre><code>Assertions.assertThat(foo.getList(), Bar.class).containsExactly(bar1, bar3);
  </code></pre>