I believe I am able to shed some light on this. I put in the duplicate ticket
GRAILS-9380 and am using 2.0.4.
I saw 1 of the previous comments on the grails.validateable.classes property workaround and was able to get stuff working based on info gained from that.
I have attached a sample app that has a command,controller, unit, and integration tests. The 2 tests are identical except for the class name and location.
For any of the tests to work it was necessary to annotate with @TestMixin(GrailsUnitTestMixin) else mockForConstraintsTests() is a MissingMethod. The physical location of the command object in the same package as the controller or in src/groovy seemed to make no difference.
I tried all of the combinations of the grails.validateable.classes property and using the @Validateable. Note the 2 different actions in the SearchController. search1 takes the SearchCommand as a method parameter while search2 creates it on the fly from the params. The Integration test always works using the TestMixin.
The search1 method is a problem regardless. If @Validateable is not used, search1 will not compile.
I'm using GroovyAndGrails ToolSuite so the problem isn't limited to IDEA. The error message is:
"Groovy:The [search1] action accepts a parameter of type [a.SearchCommand] which does not appear to be a
command object class. This can happen if the source code for this class is not in this project and the class is not
marked with @Validateable."
If @Validateable is used, the unit test fails regardless and the search1 action doesn't work right in the webapp.
The happiest workaround for me is to use neither @Validateable nor the Config property and use the @TestMIxin. In this way, the search2 technique works and so does the unit test.
This is a minor issue for me (now that I know how to deal with it) but probably should be fixed and/or documentation appropriately updated to avoid others being caught up in this. It's nice to be able to pass in the command object rather than creating it as testing the controller action is easier but I can live without it. Apparently merely having the constraints specified on the command object is enough for it to work.
Hope this helps. BTW, I am loving Grails2 ;=)