title: Error casting map to grails.gorm.CriteriaBuilder
body: <p>Could someone please tell me why I am not able to mock CriteriBuilder in my test. When criteriaBuilderMock.createMock() is executed I am getting Error casting map to grails.gorm.CriteriaBuilder, Reason: null</p>
  
  <p>Is it possible to mock CriteriaBuilder? Am I getting this error because grails does not allow mocking objects without default constructor? Is there work around?</p>
  
  <pre><code>@TestFor(ProductService)
  class ProductServiceSpec extends Specification {
  
      void "test exists"() {
          given:
          def criteriaBuilderMock = mockFor(CriteriaBuilder);
          criteriaBuilderMock.createMock(); //&lt;-- error org.codehaus.groovy.runtime.typehandling.GroovyCastException: Error casting map to grails.gorm.CriteriaBuilder, Reason: null
      }
  }
  </code></pre>
  
  <p>thanks</p>