【问题标题】:Which Dynamic methods are not included in Grails Unit Tests?Grails 单元测试中不包含哪些动态方法?
【发布时间】:2011-12-03 16:21:48
【问题描述】:

阅读有关 Grails 单元测试的文档,我发现了以下内容:

在 Grails 中,您需要特别注意 单元和集成测试,因为在单元测试中 Grails 不注入 集成测试期间出现的任何动态方法 运行时。

^Grails 9.1 Unit Testing Documenation

我假设缺少的注入方法是指:

  • 来自 GORM 和 Hibernate 的 getBy*.save() 方法

他们在这里谈论的还有其他动态注入的东西吗?

【问题讨论】:

    标签: hibernate grails grails-orm


    【解决方案1】:

    基本上所有与 GORM 相关的方法(动态查找器等)都在文档中指出。它们在单元测试(没有模拟)中不可用,仅在集成测试中可用。

    以下是单元测试期间不可用的大多数方法。

    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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-24
      • 2010-09-26
      • 1970-01-01
      相关资源
      最近更新 更多