title: How to mock createCriteria() in grails 2.1.1?
body: <p>I am working on Unit Tests for a groovy n grails application v-2.1.1</p>
  
  <p>I have a <code>createCriteria()</code> to mock, which looks like below controller code snippet:</p>
  
  <pre><code>  def updateList = {
      def Cr = Book.createCriteria()
  
      def Find = Cr.list() {
        and {
          eq ("name", params.name)
          eq ("age", params.age)
          eq ("prop", params.prop) 
        }
      }
    }
  </code></pre>
  
  <p>My test method looks like:</p>
  
  <pre><code>void testUpdateList(){
    try{
      controller.request.method = 'POST'
      controller.session.userName = "amy"
      controller.params.name = "A1"
      controller.params.age = "four"
      controller.params.prop = "D1"
      controller.updateList()     
    }catch(Exception ex){
      ex.printStackTrace()
    }
  }
  </code></pre>
  
  <p>I am able to pass <code>params</code> to the controller method through my test method.
  Can you please help me in mocking <code>createCriteria()</code> whith an example of Mocking the data so that I can validate it?</p>
  
  <p>Thanks in advance
  amy</p>