title: Grails: Is there a way to have findAll() without a query but with pagination and sorting?
body: <p>As I noticed in the answers of another <a href="https://stackoverflow.com/questions/3758347/grails-no-signature-of-method-findall-is-applicable-for-argument-types-string">question</a> there are a few problems when testing finder methods in GORM.<br>
  I want to get all objects from <code>Something</code> and have support for sorting and pagination, so I wrote this:  </p>
  
  <pre><code>SomethingListVO findAllSomethings(int offset = 0, int limit = 50) {
      def somethingCount = Something.count()
      def somethings = Something.findAll([max: limit,
                                              offset:offset,
                                              sort: "number",
                                              order: "asc"])
      return new SomethingListVO(somethingCount,somethings)
  }
  </code></pre>
  
  <p>This can't work because if you want to add something like pagination or sorting you need to have a query. But if you add a query like <code>SELECT * FROM Something</code> your test will fail.</p>
  
  <p>Is there any way to test this method (with pagination/sorting)?<br>
  <a href="http://grails.1312388.n4.nabble.com/New-approach-to-mocking-domain-classes-in-Grails-unit-tests-td2529895.html" rel="nofollow noreferrer">This approach</a> seems to provide more features but it won't work with my grails installation.</p>