grails - 测试删除()
我只是想知道为什么一种测试 delete() 的方法按预期工作,但另一种却不能? 在以下测试用例中:
def cFound = new Client( ... ).save()
def cFoundId = cFound.id
cFound.delete()
assertEquals 0, Client.count()
...assertEquals 0,Client.count() 通过,但是...
assertFalse Client.exists( cFound.id )
assertNull Client.get(cFoundId)
...都失败。根本原因可能是什么? 提前致谢。
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)
... both fail. What could be the underlying reason?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试刷新上下文,以清理缓存:
Try to flush the context, in order to clean the caches: