Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Grails新手问题:
当你有assert [condition]在 Grails 控制器中时,如何验证单元测试中的断言失败?
assert [condition]
我在想类似的东西shouldFail(Exception) { .. }但我不确定要捕获什么异常。
shouldFail(Exception) { .. }
谢谢
您可以使用AssertionError.
AssertionError
shouldFail(AssertionError) { assert 'one' == 'two' }