Reputation: 3717
I have a code which get's the file from request object
if (!request.getFile('uploadFile').isEmpty()) {
...
}
To test this I used mockRequest. I have written this unit test case in grails 1.3.7 which worked fine but the same fails after upgrading it to grails 2.2.4
mockRequest.metaClass.getFile = { file ->
return new MockMultipartFile('uploadFile', new byte[0])
}
Upvotes: 0
Views: 106
Reputation: 50245
Match signature while using metaClass. Use String file ->
.
Hope this answer can help in any ways.
FYI. mockRequest
is no more used from Grails 2.x. You can use request
instead.
Upvotes: 1