Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. java.lang.IllegalStateException: Method on class [sampleplugin.Person] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
  2. at org.grails.datastore.gorm.GormEntity$Trait$Helper.currentGormInstanceApi(GormEntity.groovy:52)
  3. at org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:165)
  4. at sampleplugin.PersonSpec.$tt__$spock_feature_0_1(PersonSpec.groovy:25)
  5. at sampleplugin.PersonSpec.test save_closure2(PersonSpec.groovy)
  6. at groovy.lang.Closure.call(Closure.java:423)
  7. at groovy.lang.Closure.call(Closure.java:439)
  8. at grails.transaction.GrailsTransactionTemplate$1.doInTransaction(GrailsTransactionTemplate.groovy:67)
  9. at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
  10. at grails.transaction.GrailsTransactionTemplate.executeAndRollback(GrailsTransactionTemplate.groovy:64)
  11. at sampleplugin.PersonSpec.test save(PersonSpec.groovy)
  12.  
  13. package sampleplugin
  14.  
  15. class Person {
  16. String name
  17. }
  18.  
  19. package sampleplugin
  20.  
  21. import grails.test.mixin.integration.Integration
  22. import grails.transaction.*
  23. import spock.lang.*
  24.  
  25. @Integration
  26. @Rollback
  27. class PersonSpec extends Specification {
  28.  
  29. void "canary test"() {
  30. expect:
  31. true == true
  32. }
  33.  
  34. void "test save"() {
  35. when:
  36. new Person(name: "John Doe").save flush:true
  37. then:
  38. 1 == Person.count()
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement