Created
February 3, 2013 15:33
-
-
Save grimrose/4702190 to your computer and use it in GitHub Desktop.
MethodExtractExampleTestをGroovyで書き直すとエラーになる件について
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package chapter11 | |
import org.junit.Test | |
import static org.hamcrest.CoreMatchers.is | |
import static org.junit.Assert.assertThat | |
class MethodExtractExampleGroovyTest { | |
@Test | |
void "doSomethingでdateに現在時刻が設定される"() { | |
// Setup | |
final Date current = new Date() | |
MethodExtractExample.metaClass { | |
newDate = { | |
println("call expanded.") | |
current | |
} | |
} | |
MethodExtractExample sut = new MethodExtractExample() | |
// Exercise | |
sut.doSomething(); | |
// Verify | |
assertThat(sut.date, is(current)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment