¤È¤¢¤ë½¸ÃÄ¤Î¥×¥í¥°¥é¥à¥á¥â


JUnit4

Install

javadoc

Setting

Maven

Maven¤Ç¤Î»ØÄê¤ò¼¨¤¹¡£¤Þ¤¿¥Þ¥Ã¥Á¥ã¡¼¤Î¥é¥¤¥Ö¥é¥ê¤Î¤Ç¤¢¤ëhamcrest-library¤Î°Í¸´Ø·¸¤âºÜ¤»¤ë¡£
<scope>¤Ïtest¤Î¤È¤­¤·¤«»ÈÍѤ·¤Ê¤¤¤Î¤Ç[test]»ØÄꤷ¤Æ¤¤¤ë¡£
<dependency>
	<groupId>junit</groupId>
	<artifactId>junit</artifactId>
	<version>4.11</version>
	<scope>test</scope>
</dependency>

<dependency>
	<groupId>org.hamcrest</groupId>
	<artifactId>hamcrest-library</artifactId>
	<version>1.3</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>org.hamcrest</groupId>
	<artifactId>hamcrest-core</artifactId>
	<version>1.3</version>
	<scope>test</scope>
</dependency>

Example

JUnit4 ¥¢¥µ¡¼¥·¥ç¥ó
¡¡fail, assertThat

¥Æ¥¹¥È¥¯¥é¥¹
¡¡@BeforeClass, @AfterClass, @Before, @After, @Test

¥Æ¥¹¥È¥¹¥¤¡¼¥È
¡¡@RunWith(Suite.class), @SuiteClasses({Hoge.class, Piyo.class})

¥Æ¥¹¥È¤Î¹½Â¤²½
¡¡@RunWith(Enclosed.class)

¥Ñ¥é¥á¡¼¥¿¥Æ¥¹¥È
¡¡@RunWith(Theories.class), @DataPoint, @DataPoints, @Theory

¥«¥Æ¥´¥ê²½¥Æ¥¹¥È
¡¡@Category(Hoge.class), @RunWith(Categories.class),
¡¡@IncludeCategory(Aho.class), @ExcludeCategory(Fuga.class),
¡¡@SuiteClasses({Hoge.class, Piyo.class})

JUnit4 ¥ë¡¼¥ë
¡¡@Rule, @RuleClass

»²¾ÈURL

´ØÏ¢URL

¥¿¥°

¥³¥á¥ó¥È¤ò¤«¤¯


¡Öhttp://¡×¤ò´Þ¤àÅê¹Æ¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

ÍøÍѵ¬Ìó¤ò¤´³Îǧ¤Î¤¦¤¨¤´µ­Æþ²¼¤µ¤¤

¥á¥ó¥Ð¡¼¤Î¤ßÊÔ½¸¤Ç¤­¤Þ¤¹