ºÇ½ª¹¹¿·¡§ numeric96key 2013ǯ12·î16Æü(·î) 04:20:44ÍúÎò
package org.sample.junit; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; import org.sample.junit.category.SlowTests; public class SampleTest1 { @BeforeClass public static void setUpBeforeClass() throws Exception { System.out.println("setUpBeforeClass"); } @AfterClass public static void tearDownAfterClass() throws Exception { System.out.println("tearDownAfterClass"); } @Before public void setUp() throws Exception { System.out.println("setUp"); } @After public void tearDown() throws Exception { System.out.println("tearDown"); } /* Ä̾ï¥Æ¥¹¥È */ @Test public void test1() { System.out.println("#test"); int actual = 1; int expect = 1; assertThat(actual, is(expect)); } /* Throw¤µ¤ì¤¿Îã³°¤ò¥Æ¥¹¥È */ @Test(expected= NullPointerException.class) public void testThrow() throws Exception { System.out.println("#testThrow"); throw new NullPointerException(); } }
- ¥«¥Æ¥´¥ê¡§
- ³ØÌ䡦Íý·Ï
- Áí¹ç
¥¿¥°
¥³¥á¥ó¥È¤ò¤«¤¯