Spock Integration Test interaction not counted <p>I want to write an integration test for my Grails User Class.</p> <p>I have a <code>afterUpdate()</code>method which calls the afterUpdate method in the userService which calls another service. </p> <p>Now I want to verify that the call to the other service is done correctly. If I debug the code, the method is called correctly. but my test always fails and says the method isn't called:</p> <pre><code> def "After Update for User"() { given: RedisService.metaClass.'static'.del = {String key -&gt; true} User user = new User() user.save(flush: true) when: user.afterUpdate() then: 1 * redisService.del(!null) } </code></pre> <p>I have tried different things like</p> <pre><code>then: 1 * user.userService.afterUpdate(!null) 1 * userService.redisService.del(!null) 1 * redisService.del(!null) </code></pre> <p>but they are all failing.</p> <p>I allways get:</p> <pre><code>| Failure: After Update for User(com.boxcryptor.server.RedisCacheIntegrationSpec) | Too few invocations for: 1 * user.userService.afterUpdate(!null) (0 invocations) Unmatched invocations (ordered by similarity): None Too few invocations for: 1 * redisService.del(!null) (0 invocations) Unmatched invocations (ordered by similarity): None </code></pre> <p><strong>Update:</strong></p> <p>the after Update Method is really simple:</p> <pre><code>def afterUpdate(User user) { deleteETagCache(user) } def deleteETagCache(User user) { redisService.del(user.id.toString()) } </code></pre>