Mock Grails Criteria Unit Test
Groovy Batchfile
Latest commit e5e51a7 Aug 19, 2016 @fabiooshiro closes #16 thx dtamm
Failed to load latest commit information.
src/groovy/plastic/criteria merge tests Aug 19, 2016
test introducing Saint Peter Oct 6, 2013
wrapper give a try travis Jan 19, 2014
.classpath Distinct working with List Dec 23, 2012
.gitignore cleanup Feb 21, 2013
.project Distinct working with List Dec 23, 2012
PlasticCriteriaGrailsPlugin.groovy Bumped Version Number Aug 19, 2016 closes #16 thx dtamm Aug 19, 2016 cleanup Feb 21, 2013
grailsw give a try travis Jan 19, 2014
grailsw.bat give a try travis Jan 19, 2014


Build Status

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.6.1"
    // (...)

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:

How to Contribute

Edit online!

or clone in your machine

write a test in CriteriaDocTests.groovy run ./wgrails test-app if you see "tests passed" make me a pull request ;-)


Sr. Oshiro, Max Mustang, Danilo Tuler

Special thx

dtamm, frozenspider, srybakov