agorapulse/gru

Error when using gru with grails 4

mortensoby opened this issue · 5 comments

When I run a gru test in grails 4.0.0.RC1 i get the following error:
`
java.lang.NullPointerException: Cannot get property 'classLoader' on null object

at grails.plugin.json.view.JsonViewGrailsPlugin.doWithSpring_closure1(JsonViewGrailsPlugin.groovy:53)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at groovy.lang.Closure.call(Closure.java:405)
at groovy.lang.Closure.call(Closure.java:399)
at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:759)
at grails.spring.BeanBuilder.beans(BeanBuilder.java:588)
at org.grails.testing.GrailsUnitTest$Trait$Helper.defineBeans(GrailsUnitTest.groovy:97)
at org.grails.testing.GrailsUnitTest$Trait$Helper.defineBeans(GrailsUnitTest.groovy:108)
at com.agorapulse.gru.grails.minions.jsonview.JsonViewRendererMinion.setupJsonViewsPlugin(JsonViewRendererMinion.groovy:80)
at com.agorapulse.gru.grails.minions.jsonview.JsonViewRendererMinion.doBeforeRun(JsonViewRendererMinion.groovy:47)
at com.agorapulse.gru.minions.AbstractMinion.beforeRun(AbstractMinion.java:24)
at com.agorapulse.gru.Squad.beforeRun(Squad.java:125)
at com.agorapulse.gru.Gru.test(Gru.java:135)
at com.agorapulse.gru.Gru.test(Gru.java:105)
at dk.ufst.HelloControllerSpec.test something(HelloControllerSpec.groovy:24)

`

Furthermore I need to explicitly add
testImplementation "com.agorapulse:gru-grails:0.8.0" testImplementation "com.agorapulse:gru:0.8.0"
to avoid getting

/home/morten/source/berigelse/src/test/groovy/dk/ufst/HelloControllerSpec.groovy: 3: unable to resolve class com.agorapulse.gru.Gru
My setup if the following:
Ubuntu
Java 8
Grails 4.0.0.RC1
Gradle 5.4

thank you for the report. can you please attach a link to the sample project to help me resolve the issue faster?

Of cause. Here you go https://github.com/mortensoby/gru-grails4 :)
Thank you for GRU

You're welcome. I believe the root cause for this error is the same as

grails/grails-testing-support#43

Still not sure about the Gradle stuff. I'm not yet familiar enough with the new api / implementation model.

@benorama can you move this issue to Gru repository as this is actually where it belongs? I don't have sufficient rights.

won't fix at the moment as Grails support is going to be discontinued soon