⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 groovytestcasetest.groovy

📁 大名鼎鼎的java动态脚本语言。已经通过了sun的认证
💻 GROOVY
字号:
/**    Testing the notYetImplemented feature of GroovyTestCase.    Todo: testing all other features.    @author Dierk Koenig*/class GroovyTestCaseTest extends GroovyTestCase {    void testNotYetImplementedSubclassUse () {        if (notYetImplemented()) return        fail 'here the code that is expected to fail'    }    void testNotYetImplementedStaticUse () {        if (GroovyTestCase.notYetImplemented(this)) return        fail 'here the code that is expected to fail'    }    // we cannot test this automatically...    // remove the leading x, run the test and see it failing    void xtestSubclassFailing() {        if (notYetImplemented()) return        assert true // passes unexpectedly    }    void xtestStaticFailing() {        if (GroovyTestCase.notYetImplemented(this)) return        assert true // passes unexpectedly    }// ----------------    void testShouldFailWithMessage() {        def msg = shouldFail { throw new RuntimeException('x') }        assertEquals 'java.lang.RuntimeException: x', msg    }    void testShouldFailWithMessageForClass() {        def msg = shouldFail(RuntimeException.class) { throw new RuntimeException('x') }        println msg        assertEquals 'x', msg    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -