What steps will reproduce the problem?
1. Simple test of grails controller where the collaborator is a controller
service
2. Behaviour of collaborator mocked in a simple manner as indicated in docs
3. The tests show the anticipated outcome when used from JUNIT runner in the
IDE but fail when the grails test-app command is issued
we see the following error reported when using grails test-app
A transform used a generics containing ClassNode groovy.lang.Closure <V extends java.lang.Object -> java.lang.Object> for the method protected java.lang.Object ordered(groovy.lang.Closure closure) { ... } directly. You are not suppposed to do this. Please create a new ClassNode refering to the old ClassNode and use the new ClassNode instead of the old one. Otherwise the compiler will create wrong descriptors and a potential NullPointerException in TypeResolver in the OpenJDK. If this is not your own doing, please report this bug to the writer of the transform.
@ line -1, column -1.
This is using GMock 0.8.1
Grails 2.0 RC1
I used STS 2.8.1 to run as JUNIT
This issue was reported in the Grails JIRA as issue
http://jira.grails.org/browse/GRAILS-8133 and closed out as a GMock bug
For completeness the source of the test appears below
package playtwo
import grails.test.mixin.*
import org.junit.*
import static org.junit.Assert.*
import org.gmock.GMockTestCase
import org.gmock.WithGMock
@WithGMock
@TestFor(WelcomeController)
class WelcomeControllerTests {
UtilService mockUtilService
@Test
void testIndexAction(){
String salutation = "hi"
mockUtilService = mock(UtilService)
with(mockUtilService){
getRandomGreeting().returns(salutation)
}
controller.utilService = mockUtilService
play{
controller.index()
println model
assertEquals "/welcome/show", view
assertEquals salutation, model.greeting
}
}
}
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by mcdon...@gmail.com on 24 Nov 2011 at 11:41
Original issue reported on code.google.com by
mcdon...@gmail.com
on 24 Nov 2011 at 11:41