testPaymentTypes_exception_in_getting_payment_types(PaymentServiceTests)
| groovy.lang.MissingMethodException: No signature of method: com.originfunds.service.PaymentService.extractExceptionMessage() is applicable for argument types: (java.lang.Exception) values: [java.lang.Exception: exception]
Turns out the problem is that in Grails 2.0, the unit testing infrastructure of Grails cleans up the meta classes between test runs.
Therefore, to solve the problem, put this in your setUp clause:
void setUp() {
MyController.metaClass.mixin(LogTrait)
}
Wednesday, 28 November 2012
Grails: Use of @Mixins in Controller/Services and unit testing methods that uses the mixin methods
So I spent an hour today trying to see why my tests are failing. I have a @Mixin in my service class and I was writing a unit test for a method that calls the mixin method. However, it was giving errors like these:
Subscribe to:
Post Comments (Atom)
Whoa you have a blog lol... looks like lots of good stuff. Ill have to dig through after finals haha.
ReplyDelete