Skip to content
Mock Grails Criteria Unit Test
Groovy Batchfile
Find file
Latest commit 8316cb7 Dec 21, 2015 @fabiooshiro Update
Failed to load latest commit information.
.settings fetchMode Feb 20, 2013
grails-app Bumped version to 1.5.2, changed update release plugin to 2.2.1, added Nov 24, 2015
src/groovy/plastic/criteria Add inList support for instanceValue as collection Dec 15, 2015
test introducing Saint Peter Oct 6, 2013
wrapper give a try travis Jan 19, 2014
.gitignore cleanup Feb 20, 2013
.project Distinct working with List Dec 23, 2012
.travis.yml give a try travis Jan 19, 2014
PlasticCriteriaGrailsPlugin.groovy Add support of collections for eq Dec 15, 2015 Update Dec 21, 2015
grailsw give a try travis Jan 19, 2014
grailsw.bat give a try travis Jan 19, 2014


From FakePlasticCriteria renamed to just PlasticCriteria.

The project is licensed under the WTFPL.


For grails 1.3.x

grails install-plugin plastic-criteria

Grails 2.x edit your /grails-app/conf/BuildConfig.groovy

    // (...)
    plugins {
        // (...) another plugins

        // add this line
        test ":plastic-criteria:1.2"
    // (...)

Sample usage

package plastic.test

import grails.test.mixin.*

// import mockCriteria() static method
import static plastic.criteria.PlasticCriteria.*

class ProductTests {

    void testSomething() {
        new Product(name: 'Foo', value: 10).save()
        new Product(name: 'Foo', value: 20).save()
        new Product(name: 'Bar', value: 200).save()
        new Product(name: 'Bar', value: 100).save()

        // replace default criteria mock

        def results = Product.withCriteria{
                groupProperty('name') // now you have groupProperty

        assert [['Foo', 30 ], ['Bar', 300]] == results


import static plastic.criteria.PlasticCriteria.*;



Full docs at:


Sr. Oshiro, Max Mustang, Danilo Tuler

Special thx

frozenspider, srybakov

Something went wrong with that request. Please try again.