我正在尝试创建一个执行HQL支持的服务方法(executeQuery)的Grails服务测试。现在应该可以使用HibernateTestMixin。但是,我无法找到或创建一个这样的工作示例。这就是我的开始:
@TestFor(FeatureRelationshipService)
@Mock([FeatureRelationship,Feature,Gene,MRNA])
class FeatureRelationshipServiceSpec extends Specification {
这给了我关于GROM不支持的字符串查询的错误(没什么新内容)。
我改为:
@TestFor(FeatureRelationshipService)
@TestMixin([HibernateTestMixin,ServiceUnitTestMixin])
@Domain([FeatureRelationship,Feature,Gene,MRNA])
或
@TestMixin(HibernateTestMixin)
@Domain([FeatureRelationship,Feature,Gene,MRNA])
我得到同样的错误:
Failure: parents for feature(org.bbop.apollo.FeatureRelationshipServiceSpec)
| org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceInterceptor': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is java.lang.NullPointerException
at grails.test.runtime.GrailsApplicationTestPlugin$1.initializeContext(GrailsApplicationTestPlugin.groovy:118)