开发者

Which Dynamic methods are not included in Grails Unit Tests?

开发者 https://www.devze.com 2023-04-11 12:04 出处:网络
Reading the documentation on Grails Unit testing I came across the following: In Grails you need to be particularly aware of the difference between

Reading the documentation on Grails Unit testing I came across the following:

In Grails you need to be particularly aware of the difference between unit and integration tests becaus开发者_JAVA技巧e in unit test Grails does not inject any of the dynamic methods present during integration tests at runtime.

^ Grails 9.1 Unit Testing Documenation

And with this I'm assuming the missing injected methods refer to:

  • the getBy*, .save() methods from GORM and Hibernate

Is there anything else that is dynamically injected that they are talking about here?


Essentially all of the GORM related methods (dynamic finders, etc.) are what are being pointed out in the documentation. They are not available in unit tests (without mocking), only in integration tests.

The following are the majority of the methods not available during unit tests.

addTo attach count countBy createCriteria delete discard executeQuery executeUpdate exists find findAll findAllBy findAllWhere findBy findWhere get getAll getDirtyPropertyNames getPersistentValues ident isAttached isDirty list listOrderBy load lock merge read refresh removeFrom save

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号