Created
February 3, 2013 15:42
-
-
Save grimrose/4702217 to your computer and use it in GitHub Desktop.
DelegateObjectSampleTest
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.* | |
import static org.junit.Assert.assertThat | |
class DelegateObjectSampleTest { | |
@Test | |
void "doSomethingを実行するとdateに現在時刻が設定される"() { | |
// Setup | |
Date current = new Date() | |
DelegateObjectSample sut = new DelegateObjectSample() | |
sut.dateFactory = new DateFactory() { | |
@Override | |
Date newDate() { | |
current | |
} | |
} | |
// Exercise | |
sut.doSomething() | |
// Verify | |
assertThat(sut.date, is(sameInstance(current))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment