title: Spock Test, only check if method is called and do not execute it
body: <p>In our Spock tests we want to check if the correct path in our software is selected. But we do not want to test the function of the methods which are called (this is done in separate tests)</p>
  
  <pre><code>def "Test"() {
      setup:
      service.metaClass.innerMethod = { -&gt; return null }
  
      when:
      service.doSomething("notexisting@test.com")
  
      then:
      1 * service.innerMethod(*_)
  }
  </code></pre>
  
  <p>This test always fails, because the code in the <code>innerMethod</code> is called and the invocations of the method calls in the <code>innerMethod</code> are counted and not the invocation of the method <code>innerMethod</code></p>
  
  <pre><code>|  Too few invocations for:
      1 * service.innerMethod(*_)   (0 invocations)
  
  Unmatched invocations (ordered by similarity):
  
      1 * secondService.doSomething()
  </code></pre>
  
  <p>How can I just get the invocation of innerMethod and mock the complete function away?</p>