Grails 2.4.4: services does not inject: integration test -
i have service dependency service like:
class parserservice { def depservice; private def parseline(lineparts) { ... def set = depservice.finditembyname(tmpmodule.name);//depservice == null ...
i try implement integration test like:
@testfor(parserservice) class parserservicetest extends integrationspec { def "should not parse comment"() { when: ... def resultlist = service.parseannotations(inputstream);
resources.groovy:
beans = { }
and have nullpointerexception: depservice - null
the @testfor
annotation unit tests. integration tests work normal beans, grails/spring inject dependencies in tests if define services properties in class, in controller/service/domain class.
Comments
Post a Comment