📄 asserttest.groovy
字号:
class AssertTest extends GroovyTestCase { void testAssert() { def x = null assert x == null assert x != "abc" assert x != "foo" x = "abc" assert x != "foo" assert x != null assert x != "def" assert x == "abc" assert x.equals("abc") assert !x.equals("def") assert !false assert !(1==2) assert !(1>3) assert !(1!=1) } void testAssertFail() { def x = 1234 def runCode = false try { runCode = true assert x == 5 fail("Should have thrown an exception") } catch (AssertionError e) { //msg = "Expression: (x == 5). Values: x = 1234" //assert e.getMessage() == msg //assert e.message == msg } assert runCode, "has not ran the try / catch block code" }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -