开发者

grails - testing delete()

I just wonder why one method to test delete() works as expected, but another does not? In the following test case:

    def cFound = new Client( ... ).save()

    def cFoundId = cFound.id
    cFound.delete()
    assertEquals 0, Client.count()

... assertEquals 0, Client.count() passes, but ...

    assertFalse Client.exists( cFound.id )
    assertNull Client.get(cFoundId)开发者_如何学Go

... both fail. What could be the underlying reason? Thanks in advance.


Try to flush the context, in order to clean the caches:

cFound.delete(flush: true)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜