ユニットテストを記述する際に問題になるのがモックの作成方法だ。テストケース時にモックに差し替えることを想定してしたコードであればテストケースでモックに差し替えることは難しくない。しかし、差し替えるモックを作成する手間は馬鹿にならない。そこで登場するのがモックライブラリだ。 モックライブラリはテストケースで使用するためのモックオブジェクトを手軽に作成するためのものだ。実際にモックオブジェクトのクラスを定義しなくても、動的にモックオブジェクトを作成できるものが多い。 Java向けのモックライブラリにはJMock、EasyMockなどさまざまなものがあるが、本稿で紹介するのはMockitoという比較的新しいモックライブラリだ。 MockitoのWebサイト MockitoはMITライセンスで開発されているオープンソースソフトウェアで、他のモックライブラリと比較して直感的な記述でモックの挙動を設定
We are sorry, but the site you are looking for no longer exists Wikispaces was founded in 2005 and has since been used by educators, companies and individuals across the globe. Unfortunately, the time has come where we have had to make the difficult business decision to end the Wikispaces service. We first announced the site closure in January 2018, through a site-wide banner that appeared to all
Most Java unit tests consist of a Class Under Test (CUT), and possibly dependencies or collaborators. The CUT, dependencies and collaborators need to be created somewhere. Some people create each object using 'new' (vanilla construction), others use patterns such as Test Data Builders or Object Mother. Sometimes dependencies and collaborators are instances of concrete classes and sometimes it make
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く