grails - getAll() does not work in unit tests -
grails - getAll() does not work in unit tests -
for simple domain class this:
class color { string name; }
why doesn't getall()
work?
@testfor(mycolorservice) @testmixin(domainclassunittestmixin) @mock([color, shade, colorshade]) class mycolorservicespec extends specification { def color def setup() { color = new color(name: "red") color.save(flush: true) } def "test colors shade" () { expect: 1 == color.count "red" == color.all[0].name "red" == color.getall([1]).name } }
the test fails with:
"red" == color.getall([1]).name | | | false [null] []
i've tried on grails 2.2.4
, 2.4.0
try
"red" == color.getall([1l]).name
you using integer whilst id type domain classes long
grails spock
Comments
Post a Comment