I can mock calls to:
MyDomainClass.createCriteria().list{
eq(\'id\',id)
eq(\'anotherParameter\',anotherParameterId)
}
with:
<
This should be much simpler now with the GrailsUnitTestCase.mockDomain
1 method.
package sandbox.grails.foo
class Something {
String name
}
package sandbox.grails.foo
import grails.test.mixin.*
import org.junit.*
@TestFor(Something)
class SomethingTests {
void testSomething() {
mockDomain(Something, [
new Something(name: 'Foo'),
new Something(name: 'Bar'),
new Something(name: 'Boo'),
new Something(name: 'Baz')
])
def actuals = Something.createCriteria().list(sort: 'name', order: 'asc') {
like('name', '%oo')
}
assertEquals 2, actuals.size()
}
}