title: How do I assert that a List contains exactly one instance of a particular class?
body: <p>I'd like to test that a list contains instances of an object.</p>
  
  <p>For instance, with a single instance:</p>
  
  <pre><code>assertThat(mylist).containsExactly(Matchers.any(ExpectedType.class));
  </code></pre>
  
  <p>The array returned from tested <code>obj</code> does contain exactly one object of instance <code>ExpectedType</code>.
  However my test fails with:</p>
  
  <blockquote>
    <p>java.lang.AssertionError: Not true that &lt;[ExpectedType@7c781c42]> contains exactly &lt;[an instance of ExpectedType]>. It is missing &lt;[an instance of ExpectedType]> and has unexpected items &lt;[ExpectedType@7c781c42]></p>
  </blockquote>
  
  <p>How can I write this test?</p>