2016-04-06 22 views
1

私はGrails 3.1.4を使用しています。ドメインオブジェクトを作成し、ユニットテストを作成しました。 テストは私のコンピュータで正常に実行されます。Grailsは実現できません。ドメインクラス

Tests on my computer

しかし、他のdeveloppersのコンピュータ上と継続的インテグレーション・プラットフォーム上で、テストが例外で失敗:

java.lang.IllegalStateException: Either class [ ] is not a domain class or GORM has not been initialized correctly or has already been shutdown. If you are unit testing your entities using the mocking APIs 
at org.grails.datastore.gorm.GormEnhancer.stateException(GormEnhancer.groovy:159) 
at org.grails.datastore.gorm.GormEnhancer.findValidationApi(GormEnhancer.groovy:173) 
at org.grails.datastore.gorm.GormValidateable$Trait$Helper.currentGormValidationApi(GormValidateable.groovy:120) 
at org.grails.datastore.gorm.GormValidateable$Trait$Helper.validate(GormValidateable.groovy:87) 
at com.cscinfo.platform.constraint.CascadeValidationConstraint.validateValue(CascadeValidationConstraint.groovy:43) 
at com.cscinfo.platform.constraint.CascadeValidationConstraint.processValidateWithVetoing_closure1(CascadeValidationConstraint.groovy:29) 
at groovy.lang.Closure.call(Closure.java:426) 
at com.cscinfo.platform.constraint.CascadeValidationConstraint.processValidateWithVetoing(CascadeValidationConstraint.groovy:28) 
at grails.validation.AbstractVetoingConstraint.validateWithVetoing(AbstractVetoingConstraint.java:33) 
at grails.validation.ConstrainedProperty.validate(ConstrainedProperty.java:967) 
at org.grails.validation.GrailsDomainClassValidator.validatePropertyWithConstraint(GrailsDomainClassValidator.java:211) 
at org.grails.validation.GrailsDomainClassValidator.validate(GrailsDomainClassValidator.java:81) 
at org.grails.datastore.gorm.GormValidationApi.doValidate(GormValidationApi.groovy:89) 
at org.grails.datastore.gorm.GormValidationApi.validate(GormValidationApi.groovy:161) 
at org.grails.datastore.gorm.GormValidateable$Trait$Helper.validate(GormValidateable.groovy:87) 
at api.mails.MailSpec.Test la validation d'un mail incorrect 2(MailSpec.groovy:66) 

GORMが私のドメインオブジェクトを取得することができないようです。

私のコンピュータにはバグを再現できません。 ヘルプやドキュメントをお待ちしております。 ありがとう!

+0

devとprodで同じdataSourcesを使用していますか? –

答えて

9

私のユニットテストのいくつかのojectは嘲笑されませんでした。 私は@Mockアノテーションにオブジェクトの配列を配置していますが、これは私の継続的な統合プラットフォーム上で動作します。

@TestFor(SMTPMailerService) 
@Mock([Mail, DestinataireMail, PieceJointeMail]) 
class SMTPMailerServiceSpec extends Specification { 

誰かを助けてくれることを願っています!

+0

本当に、それは私に多くの助けになります! –

+0

ありがとうございます!これを追跡する日を費やして、あなたの答えが問題を解決しました! – franzcatch

関連する問題