« Return to Thread: Problems Unit Testing .list() etc methods

Problems Unit Testing .list() etc methods

by Christian1 :: Rate this Message:

Reply to Author | View in Thread

I'm coming up against a problem when attempting to unit test controller actons, with .list() or dynamic finder methods that take maps of values. For example:

ExampleDomain.findAllBySalesCampaign( salesCampaignInstance, [sort:"sequenceNumber", order:"asc"] )

or

ExampleDomain.list( params )   ( where params contains a value max: 10 )

The error I get when executing these lines of code in my test is:

Negative array index [-1] too large for array size 0

I'm using mockDomain() to mock the objects, and have also tried using mockFor() to mock those methods individually, but with no success.

Has anyone else experienced this problem and know of a work around?

Thanks

Christian

 « Return to Thread: Problems Unit Testing .list() etc methods