title: How to match collection contents in Spock interactions?
body: <p>Given I have the following method in a class that I mock:</p>
  
  <pre><code>class Foo {
     public void doSomething(Collection&lt;String&gt; input) {
       //...
     }
  }
  </code></pre>
  
  <p>Now I mock this class in my Spock test and I want to verify an interaction:</p>
  
  <pre><code>def test() {
      setup:
      def myMock = Mock(Foo)
  
      when:
      def hashSet = new HashSet&lt;String&gt;(['foo', 'bar'])
      myMock.doSomething(hashSet)
  
      then:
      1 * myMock.doSomething(['foo', 'bar'])
  
  }
  </code></pre>
  
  <p>This interaction however doesn't trigger. What is really strange is that the output is telling me:</p>
  
  <pre><code>too few invocations for:
  
  1 * myMock.doSomething(['foo', 'bar'])   (0 invocations)
  
  Unmatched invocations (ordered by similarity):
  
  1 * myMock.doSomething(['foo', 'bar'])
  </code></pre>
  
  <p>So it basically told me that there was no invocation that looked like the one I was expecting but there was another one which ... ermm looked like the one I was expecting.</p>
  
  <p>Am I doing something wrong here or is this a limitation of Spock and I need to check the collection contents in a closure like</p>
  
  <pre><code>1 * mock.doSomething( { it == ['foo', 'bar'] })
  </code></pre>