Skip to content

Instantly share code, notes, and snippets.

@ryu22e
Created November 8, 2011 08:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryu22e/1347282 to your computer and use it in GitHub Desktop.
Save ryu22e/1347282 to your computer and use it in GitHub Desktop.
入れ子構造になっているJUnit4テストの書き方
package org.ryu22e;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
/**
* @author ryu22e
* @see <a href="http://d.hatena.ne.jp/shuji_w6e/20111205/1323098690">http://d.hatena.ne.jp/shuji_w6e/20111205/1323098690</a>
*/
@RunWith(Enclosed.class)
public class PlayerTest {
public static class 打率の計算ができる {
@Test
public void 安打数を打数で割って打率を求める() throws Exception {
// TODO テストの内容を書く。
}
}
public static class 値の丸めができる {
@Test
public void 小数点第4位が4以下なら切り捨て() throws Exception {
// TODO テストの内容を書く。
}
@Test
public void 小数点第4位が5以上なら切り上げ() throws Exception {
// TODO テストの内容を書く。
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment