title: Spock mock returns null inside collabolator but not in feature method
body: <p>I have a problem with Spock Mock() object.
  I have a java class I'm trying to test. This class does some ftp stuff I want to mock.
  My sample code</p>
  
  <pre><code>class ReceiveDataTest extends Specification{
      String downloadPath = 'downloadPath';
      String downloadRegex = 'downloadRegex';
      SftpUtils sftpUtils = Mock();
      ReceiveData receiveData;
  
      def setup(){
          sftpUtils.getFileNames(downloadPath,downloadRegex) &gt;&gt; ['file1', 'file2']
          receiveData= new ReceiveData()
          receiveData.setDownloadPath(downloadPath)
          receiveData.setDownloadRegex(downloadRegex)
          receiveData.setSftpUtils(sftpUtils);
  
      }
  
      def "test execute"() {
          given:
          def files = sftpUtils.getFileNames(downloadPath,downloadRegex)
          files.each{println it}
          when:
          receiveData.execute();
          then:
          1*sftpUtils.getFileNames(downloadPath,downloadRegex)
      }
  
  }
  
  public class ReceiveData(){
  
    //fields, setters etc
  
      public void execute() {
          List&lt;String&gt; fileNames = sftpUtils.getFileNames(downloadPath, downloadRegex);
  
          for (String name : fileNames) {
              //dowload and process logic
          }
  
      }
  }
  </code></pre>
  
  <p>Now, inside "test execute" the files.each{} prints what is expected. But when receiveData.execute() is called my sftpUtils are returning null..
  Any ideas why?</p>
  
  <p>EDIT
  Maybe i didnt state my problem well - that I dont want to just check if getFileNames was called. I need the result to proper check the for loop. If I comment the loop inside execute, the test passes. But since I use the result of the getFilenames() method, I get a NPE execute method reaches the for loop. With mockito I would do something like this </p>
  
  <pre><code>Mockito.when(sftpUtils.getFilenames(downloadPath, downloadRegex)).thenReturn(filenamesList);
  receiveData.execute();
  
  Mockito.verify(sftpUtils).getFilenames(downloadPath, downloadRegex);
  //this is what I want to test and resides inside for loop
  Mockito.verify(sftpUtils).download(downloadPath, filenamesList.get(0));
  Mockito.verify(sftpUtils).delete(downloadPath, filenamesList.get(0));
  </code></pre>
  
  <p>but I cannot use Mockito.verify() inside Spock then block</p>