목차

Groovy Unit Test

Stub

Mock

Java Unit Test로 수행하기

shouldFail for JUnit 4

class ArithmeticTest {
    final shouldFail = new GroovyTestCase().&shouldFail
 
    @Test
    void divideByZero() {
        String message = shouldFail(ArithmeticException) {
            println 1/0
        }
        assertEquals message, "expected exception message."
    }
}