JUnit
流れ Eclipseでごにょごにょするのが嫌だったので。 AntでJUnit 4.10のテストを実行する - Symfoware ソースコードは↑のリンクを参照した。 以下ディレクトリ構成。 $ tree -a -I .git . ├── .gitignore ├── .travis.yml ├── README.md ├── build │ └── samp…
日付の比較検証を行うカスタムMatcherの要件 クラスを作成する ファクトリメソッドを作成する コンストラクタを定義する matchesメソッドを実装する describeToメソッドを実装する public class IsDate extends BaseMatcher<Date> { private final int yyyy; priva</date>…
import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*;
int expected = 7; int actual = add(3, 4); assertThat(actual, is(expected)); 検証コードが自然言語の表記に近くなる。