title: How to mock multiple methods of same class in grails using spock?
body: <p>I have a unit test in which I want to mock two methods of a service. I know how to do it once : </p>
  
  <pre><code>def caseHistoryMock = mockFor(CaseHistoryService)
          caseHistoryMock.demand.getLatestCaseHistory(1..1) {String caseNumber, String productFamily -&gt; return caseHistoryObj }
          controller.caseHistoryService = caseHistoryMock.createMock()
  </code></pre>
  
  <p>How do I mock another method of caseHistoryService. The calls to methods in my controller are as follows :</p>
  
  <pre><code>def caseHistoryObj = caseHistoryService.getLatestCaseHistory(alert.caseNumber, alert.productFamily)
  </code></pre>
  
  <p>and </p>
  
  <pre><code>caseHistoryService.saveCaseHistory(caseHistoryMap)
  </code></pre>
  
  <p>*I am using grails 2.5.1.
  Thanks in advance,
  Apoorv</p>